|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Module to deal with PGP-encrypted email messages in 2025by Nocturnus (Scribe) |
| on Aug 07, 2025 at 17:16 UTC ( [id://11165982]=perlquestion: print w/replies, xml ) | Need Help?? |
|
Nocturnus has asked for the wisdom of the Perl Monks concerning the following question: Dear well-respected monks, I was wandering in the darkest night without any hope and orientation, but finally saw the promising lights of the monastery. The heart began to beat again, and I dare to ask you for your wisdom regarding the following question: I need to deal with PGP-encrypted email messages. To be precise, I would like to permanently decrypt thousands of PGP-encrypted email messages that I have on disk in the form of .eml files. To my surprise, I haven't found a PGP module for Perl that actually is usable in 2025 with recent Perl versions. Then there is Mail:GnuPG. It seems to be the predecessor of Mail:PGP, seems to contain some bugs, and seems to be even more outdated. I managed to install it under Linux, but failed to install it under Cygwin and under Strawberry Perl. The latter would not be the key point, but for certain reasons it would simply be more comfortable for me to run the script under native Windows. At least, Mail::GnuPG could be the last resort. I am quite sure that I have missed something. What module would you, dear monks, use nowadays to decrypt PGP-encrypted email messages? To avoid misunderstandings: This question is about email messages that mostly contain nested MIME structures. When decrypting, all mail headers, MIME parts and attachments of the respective message should be preserved or decrypted, respectively. This means that I cannot use the Perl modules that can handle PGP on ordinary files; that would indeed be a no-brainer. Furthermore, I could use the GnuPG application directly to permanently decrypt those messages; I have verified that this is possible in general. However, when doing this, the mail headers of the original message do not exist any more in the decrypted version. Instead, the decrypted version contains the headers that were in the encrypted part of the original message. For example, the Date header gets lost; funnily enough, it exists only as a non-encrypted header in the original message. When anything else fails, I'll eventually take that route: Decrypt using the GnuPG application directly, then merge the headers from the original message with those of the decrypted message. As mentioned above, I'd like to listen to the monks before I take that effort. Your devoted novice Nocturnus
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||