Class: Mail::Gpg::MimeSignedMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/mail/gpg/mime_signed_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(signed_mail, options = {}) ⇒ MimeSignedMessage

Returns a new instance of MimeSignedMessage.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mail/gpg/mime_signed_message.rb', line 7

def initialize(signed_mail, options = {})
  content_part, signature = signed_mail.parts
  success, vr = SignPart.verify_signature(content_part, signature, options)
  super() do
    verify_result vr
    signed_mail.header.fields.each do |field|
      header[field.name] = field.value
    end
    content_part.header.fields.each do |field|
      header[field.name] = field.value
    end
    if content_part.multipart?
      content_part.parts.each{|part| add_part part}
    else
      body content_part.body.to_s
    end
  end
end