Project

General

Profile

« Previous | Next » 

Revision 326064f7

Added by Marc Dequènes over 10 years ago

[fix] fixed several silly mistakes when mail/gpg was created

View differences:

lib/mail/gpg.rb
mime_type == "multipart/signed" and
content_type_parameters['protocol'] == "application/pgp-signature" and
parts.size == 2 and
pgp_signature_part
not pgp_signature_part.nil?
end
def pgp_signature_part
......
def pgp_signed_part
return nil unless is_pgp_signed?
p = parts.detect { |p| p.mime_type != "application/pgp-signature" && !p.attachment? }
parts.detect { |p| p.mime_type != "application/pgp-signature" && !p.attachment? }
end
def verify_pgp_signature
......
mime_type == "multipart/encrypted" and
content_type_parameters['protocol'] == "application/pgp-encrypted" and
parts.size == 2 and
pgp_crypt_info_part and
pgp_encrypted_part
not pgp_crypt_info_part.nil? and
not pgp_encrypted_part.nil?
end
def pgp_crypt_info_part
......
def create_encrypted(crypters_id)
# build properly encrypted mail
# (preserving headers from original mail)
mail = Mail::Message.new
mail = self.class.new
mail.copy_headers_from(self)
# cryptographic info
......
p_encrypted = Mail::Part.new
p_encrypted.content_type = "application/octet-stream"
p_encrypted.content_transfer_encoding = "7bit"
p_encryptedcontent_disposition = "inline"
p_encrypted.content_disposition = "inline"
p_encrypted.body = encrypted_data
mail.add_part(p_encrypted)
......
def create_signed(signers_id)
# build properly signed mail
# (preserving headers from original mail)
mail = Mail::Message.new
mail = self.class.new
mail.copy_headers_from(self)
# signed message
......
end
# signature
p_signature = Mail::Message.new
p_signature = Mail::Part.new
p_signature.content_type = "application/pgp-signature"
p_signature.content_transfer_encoding = "7bit"
p_signature.content_disposition = "inline"

Also available in: Unified diff