Decrypting PGP/MIME on the command line

René Puls rpuls at
Mon Mar 2 16:40:11 CET 2015

On Mon, 02 Mar 2015 00:34:55 +0100 Daniel Kahn Gillmor wrote:
> On Sun 2015-03-01 20:01:05 +0100, Werner Koch wrote:
> > On Sun,  1 Mar 2015 15:32, rpuls at said:
> >
> >> is there a command line utility that takes a PGP/MIME encrypted
> >> message (a plain RFC 2822 text file) and outputs an unencrypted
> >> copy? The
> >
> > Not really.  MIME is a structured format and as such it may result
> > in a bunch of encrypted, non-nencrypted, signed, unsigned,
> > message/alternative sub-documents.  Thus it is not easy to write a
> > general purpose command line tool.
> python's email module is quite good for programmatically handling mime
> parts if you want to manipulate an e-mail (though it may not be so
> good for reconstructing it in some sort of bytewise exact fashion).

Python seems to be the best solution for me, at least I have some
experience with the language.

Thank you, also to Werner and Doug, for the suggestions.

> A tool that transforms an OpenPGP encrypted+signed MIME message into
> an OpenPGP-signed MIME message while retaining the original signature
> would be a really nice tool to have.

I will post here if I manage to come up with something useful. :-)


More information about the Gnupg-users mailing list