I think you're right. Before the P,Q,G params, I see (0x02, 0x41, 0x00), (0x02, 0x15, 0x00), and (0x02, 0x41, 0x00) respectively. 0x41 and 0x15 appear to be 1 greater than the actual length of the params. Any idea why it is 1 greater than the actual length?
But before the public key, I see (0x30, 0x81, 0xDF, 0x02, 0x40). Can you tell me what these values represent? The pubkey is 0x40 bytes. I assume 0x02 is the integer type. What are the first 3 bytes? > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:owner-openssl- > [EMAIL PROTECTED] On Behalf Of jimmy bahuleyan > Sent: Monday, July 30, 2007 6:55 AM > To: openssl-users@openssl.org > Subject: Re: i2d_DSAPublicKey > > Hi, > > Edward Chan wrote: > > When I call this function, I can see from the generated binary data that > > the format is the public key, followed by the P param, followed by 3 > > bytes which I don't know what they are, followed by the Q param, > > followed by the G param. > > > > You have got an ASN.1 DER encoding which is Tag || Length || Value > > Since P, Q, G are integers they'll encoded with the tag of an integer > (0x2 i think), followed by a length and then the value bytes. > > > > > I haven't tried generating more than one DSA pub/priv key pair yet using > > these params so I don't know if these 3 bytes are the same all the time, > > but does someone know off hand what those bytes are? > > > > If you can tell what those bytes are which are confusing you maybe > someone can confirm that you are indeed seeing the ASN.1 tag|length. > > > > > > > Is there some standard encoding for how a public key and private key are > > stored? i.e. do the params always come after the pub/priv key, or > > before? And do they always appear in the order of P,Q,G? > > > > Yes, it is a standard. Please refer to RFC 3279 for DSSParms. > > -jb > -- > Tact is the art of making a point without making an enemy. > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager [EMAIL PROTECTED] ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]