Parsing decrypted PGP email

115 Views Asked by At

I have a problem with decrypted email content that is encrypted with PGP. When I decrypt the mail using mail-gpg (or any other gem) the result is not a mail object; it'ss just the source of email, something like the structure below.

I tried using the mail gem and also another gem called mail_parser and none of them could parse this source.

Here is an example of the decrypted source:

gpg: encrypted with 2048-bit RSA key, ID 0A8387EEB8F331211, created 2019-06-18
      "[email protected]"
gpg: encrypted with 2048-bit RSA key, ID 5CA8644C56CC12BD, created 2019-06-18
      "[email protected] <[email protected]>"
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="3c4321aa4bd8591a78df6a5539b7bbb2"

--3c4321aa4bd8591a78df6a5539b7bbb2
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="msg.txt"

Subject: subject is encrypted too

Why body and subject is encrypted =3F

--3c4321aa4bd8591a78df6a5539b7bbb2
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="Modern.srt"

77u/MQ0KMDA6MDA6MDMsMjM3IC0tPiAwMDowMDowNSw2MzkNCuKAq9qG2LHYpyDYrdix2YEg2YbZ
hduM2LLZhtuM2J8NCuKAq9in2LIg2K/Ys9iqINmF2YYg2LnYtdio2KfZhtuMINmH2LPYqtuM2J8N


--3c5991aa4bd8591a78df6a5539b7aaa2
0

There are 0 best solutions below