converting between detached undetached signatures?

David Shaw dshaw at
Tue Nov 6 06:29:54 CET 2007

On Mon, Nov 05, 2007 at 09:33:52PM -0600, Paul Elliott wrote:
> Another user has created a digital signature. I do not have
> the secret key. I want to convert it's form. There are two
> possiblities:
> 1) It is a detached signature, I want to convert it to
> a regular undetached signature. (I have the file that
> was signed.)

gpg -z0 --store the-original-file
cat the-detached-sig.sig the-original-file.gpg > my-new-joined-file.gpg

Note that if the signature is a text-mode signature, you need to add
--textmode to the --store command.

> 2) It is a regular not detached signature and
> I want to convert it to a detached signature.

Use gpgsplit to break the file up into packets.  Note that you might
need to use 'gpgsplit --uncompress' if the original file was
compressed, and then run gpgsplit again on the uncompressed file.

Find the file that ends in ".sig".  That's the detached signature.

There are a few very obscure cases where you can't do these two
tricks.  If you have a textmode signature, and the original document
has whitespace at the end of the line, and your other user is using
PGP (not GPG) then you might have a problem.  Incidentally, this is
one of the things that RFC-4880 resolved.


More information about the Gnupg-users mailing list