Subject: self-sign v3

From: welintin son <[email-masked]>
Date: Tue, 26 Jul 2005 16:09:11 -0300

Hi i'm having troubles trying to make a self-sign to use in a public key packet.
I'm using this way :

MD5(0x99(1byte), KEYLEN(2bytes - big endian), KEYDATA, USERID,
SIGNATURE TYPE(0x10 - 1byte), CREATION TIME(4bytes - big endian))

this hash is encrypted using the pubkey i'm exporting and the pkcs1 padding.

Thanks in advance,

---

From: welintin son <[email-masked]>
Date: Wed, 27 Jul 2005 14:56:39 -0300

Hi,

I'm trying to export a key in PGP v3, but unfortunaly i'm having
problems with the
self-signature type 0x10. I can export the PubKey but the hash doesn't
match, i did like is
explained in the RFC 2440 as follows :

5.2.4. Computing Signatures

..."When a signature is made over a key, the hash data starts with the
octet 0x99, followed by a two-octet length of the key, and then body
of the key packet."...

..."A certification signature (type 0x10 through 0x13) hashes the user id
   being bound to the key into the hash context after the above data. A
   V3 certification hashes the contents of the name packet, without any
   header."...

..."Once the data body is hashed, then a trailer is hashed. A V3
   signature hashes five octets of the packet body, starting from the
   signature type field. This data is the signature type, followed by
   the four-octet signature time."...

I did like this : 

MD5(0x99(pkt type), 0x00  0x80(key size - big endian), 128bytes(key data), 
26bytes(user name - just the "name <email>"), 0x10(sig class), 0x42
0xe7 0xc9 0x18(creation time timestamp - big endian));

i'm encripting with the private key that is correlated with the public
key that i'm
exporting.

Can anyone help me?

Thanks in advance,