convert .asc to .gpg (and eventually vice-versa)

David Shaw dshaw at
Mon Oct 10 03:06:01 CEST 2011

On Oct 9, 2011, at 6:36 PM, Jbar wrote:

> Hi, It is maybe a dumb question, but I don't have found an easy way to convert a signed message from .asc to a .gpg ?
> I have to send signed message trough text-only channel, but i would like to store only binary version to save disk space. (I have 
> to keep the signature with the message)
> Should I uuencode .gpg message before to send it through the text-only channel, or is there a (easy) way to convert .asc to .gpg 
> (and also .gpg to .asc) ?

"gpg --dearmor the-asc-file.asc" will convert from .asc to .gpg

To go from .gpg to .asc is a little trickier since it doesn't know what sort of message it is (that is, it could be a public key, an encrypted or signed message, a detached signature, etc).  In your case you say it's a signed message so that's a "PGP MESSAGE", so you can do it with
"gpg --enarmor the-gpg-file.gpg" and then edit the file and change "BEGIN PGP ARMORED FILE" to "BEGIN PGP MESSAGE" at the top and a similar change at the end.  Or assuming you have sed handy you could do something like:

cat the-gpg-file.gpg | gpg --enarmor | sed 's|ARMORED FILE|MESSAGE|' > my-new-asc-file.asc


More information about the Gnupg-devel mailing list