Project

General

Profile

« Previous | Next » 

Revision dcbc5f76

Added by Marc Dequènes over 14 years ago

  • ID dcbc5f761cb0ddabed4d5a873f9f979875014cf8

[fix] ensure to_rfc3156() is strict, and ensure quoted_body message is properly added for signed/crypted

View differences:

lib/tmail_gpg.rb
end
def to_rfc3156
# using RAW part, without any decoding
# remove last EOL due to MIME protocol and properly convert all EOL to CRLF
raw.chomp.gsub(/\r?\n/, "\r\n")
# - using RAW part, without any decoding
# - remove last EOL due to MIME protocol
# - remove lines containing only whitespaces
# - remove trailing whitespaces
# - properly convert all EOL to CRLF
raw.chomp.split(/\r?\n/, -1).select{|l| not l =~ /^ +$/}.join("\n").gsub(/ +$/, "").gsub(/\r?\n/, "\r\n")
end
def create_encrypted(crypters_id)
......
mail.set_content_type("multipart", "encrypted", {'boundary' => TMail.new_boundary, "protocol" => "application/pgp-encrypted"})
mail.transfer_encoding = "7bit"
mail['content-disposition'] = nil
mail.body = "This mail is a RFC3156 encrypted message.\n"
mail.parts.clear
mail.quoted_body = "This mail is a RFC3156 encrypted message.\n"
# cryptographic info
p_pgp = TMail::Mail.new
......
mail.set_content_type("multipart", "signed", {'boundary' => TMail.new_boundary, 'protocol' => "application/pgp-signature", 'micalg' => sign_data[:micalg]})
mail.transfer_encoding = "7bit"
mail['content-disposition'] = nil
mail.body = "This mail is a RFC3156 signed message.\n"
mail.parts.clear
mail.quoted_body = "This mail is a RFC3156 signed message.\n"
# signed message
p_signed = data
......
fake_mail.content_disposition = self.content_disposition if self.content_disposition
if self.multipart?
self.each_part {|p| fake_mail.parts << p }
else
fake_mail.quoted_body = self.quoted_body
end
fake_mail.quoted_body = self.quoted_body
# store the calculated content, to be able to use parsing methods
fake_mail.write_back

Also available in: Unified diff