Re-attaching a signature

Trammell Hudson hudson at osresearch.net
Sun Apr 6 22:59:56 CEST 2008


Is there a way to detach a signature from a message after it has
already been signed and then to-reattach it?  As an example, let's
say that I've received a signed message encrypted to me and I want
to be able to decrypt it, verify the signature and then re-encrypt
it to resend it to someone else, but with the original signature
rather than mine.

I've been able to use gpgsplit to generate the separate packets
from the outer-most encrypted message (the encryption key and
the encrypted data packet), but do not know how to get the data
packets from the message once it has been decrypted.  Looking at the
output from --list-packets, I'm interested in the 'onepass_sig',
'literal data' and 'signature' packets that are nested in the
'encrypted data' packet:

:pubkey enc packet: version 3, algo 16, keyid 366DE80896CDC35C
        data: [2048 bits]
        data: [2048 bits]
:encrypted data packet:
        length: 205
        mdc_method: 2
gpg: encrypted with 2048-bit ELG-E key, ID 96CDC35C, created 2008-04-06
      "Test Key <test at example.org>"
:compressed packet: algo=2
:onepass_sig packet: keyid 317BCDBAC7BE611A
        version 3, sigclass 00, digest 2, pubkey 17, last=1
:literal data packet:
        mode b (62), created 1207514699, name="clear.txt",
        raw data: 128 bytes
:signature packet: algo 17, keyid 317BCDBAC7BE611A
        version 3, created 1207514699, md5len 5, sigclass 00
        digest algo 2, begin of digest 8e 1e
        data: [158 bits]
        data: [158 bits]

If I use --status-fd, there are lots of data reported, but I do not
know if any of it can be used to generate the signature.  The SIG_ID
reported is 27 bytes long in radix-64, which would result in the
158 bit signature + 4 bit CRC, but I'd rather find an easier way!

[GNUPG:] ENC_TO 366DE80896CDC35C 16 0
[GNUPG:] GOOD_PASSPHRASE
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] PLAINTEXT 62 1207514699 clear.txt
[GNUPG:] PLAINTEXT_LENGTH 128
[GNUPG:] SIG_ID ziWhsXtNDWk/TEDZiE+nEZB0x/w 2008-04-06 1207514699
[GNUPG:] GOODSIG 317BCDBAC7BE611A Trammell Hudson <hudson at osresearch.net>
[GNUPG:] VALIDSIG 2CAAF424FC407D1904A56AD8317BCDBAC7BE611A 2008-04-06 1207514699
 0 3 0 17 2 00 2CAAF424FC407D1904A56AD8317BCDBAC7BE611A
[GNUPG:] TRUST_UNDEFINED
[GNUPG:] DECRYPTION_OKAY
[GNUPG:] GOODMDC
[GNUPG:] END_DECRYPTION

Thanks!
-- 
Trammell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
URL: </pipermail/attachments/20080406/034183e2/attachment.pgp>


More information about the Gnupg-users mailing list