Subject: pgp-6.5.8 secret key keyID export bug? / rfc doesn't specify keyIDs

From: Adam Back <[email-masked]>
Date: Fri, 23 Mar 2001 23:27:45 -0400

I notice that pgp-6.5.8 outputs (using pgpacket3.1.pl), when you export a
private DSA key:

> ---------------------------
> Packet Type:    Secret Key Packet
> Length: 443
> Version Byte:   4
> Key Created:    23 Mar 2001  00:32:07
> Algorithm:      17 (DSA)
> P:      0xFF1C014574D484878B11438147F1B6D763701B486BFBFED1CC151533CDEBC0B3871A5180B209195E28FB6B4F8C9DDC354CE97CF73ADD0B9AB7855F3AC5A915A9A5F75008ABD4FB0E751D3B31FBE63A8F8BC961FCA625B8F0F990B7EC989875A1119470C5DCA4C692C7687B901B86C0105A4A8AE2A56F373B3603C1970F7AB6D5
> Q:      0xFFF7C19017F4FDB1BA22D013835819FFBD290F91
> G:      0x3706F602DB508F8AC6B871EB266712859A2F52A90F311DA9D6033FE251E58BDDF7BFDF7EE52558E270677F19AF2AEAE4E1AF6E723B79382DB2DAB846FDB8A852630BC1A9B1E4B7CE185A8211B0F91CBF04C086DAA921F254B5C9A92FA1023D2AB4A472EFD524321D8D1920CCF9CE339BC11ED4FFE7CAC886503461B6CE9CD528
> Y:      0x13035892703E33CEA75C2E437444D5EC1E9CE5F1473442760A1C3EB34A15331EC6AF6673F5287C20FEE84B5193CD784214DAFF55AD09737E7A724AE18F8D2E1DA5EB1CB33A7F0B33D001EBD003C2F60D550EC6DC71ADD68457A5F34EEE10031875885622670DC9541E0F2DD5472B04A3C3AA5BA0EA856DFCA6CC862DA216EE1B
> Protection Algorithm: 0 (None).
> X:      0x009E3362E8C0A65C6921FCE2890727BC0DD4E1C8E83A
> Checksum:       0x0B64
> Key ID: 0xBF9829693FEB29C7

but the public key keyID is different (and correct):

---------------------------
Packet Type:	Public Key Packet
Length:	418
Version Byte:	4
Key Created:	23 Mar 2001  00:32:07
Algorithm:	17 (DSA)
P:
0xFF1C014574D484878B11438147F1B6D763701B486BFBFED1CC151533CDEBC0B3871A5180B209195E28FB6B4F8C9DDC354CE97CF73ADD0B9AB7855F3AC5A915A9A5F75008ABD4FB0E751D3B31FBE63A8F8BC961FCA625B8F0F990B7EC989875A1119470C5DCA4C692C7687B901B86C0105A4A8AE2A56F373B3603C1970F7AB6D5
Q:	0xFFF7C19017F4FDB1BA22D013835819FFBD290F91
G:
0x3706F602DB508F8AC6B871EB266712859A2F52A90F311DA9D6033FE251E58BDDF7BFDF7EE52558E270677F19AF2AEAE4E1AF6E723B79382DB2DAB846FDB8A852630BC1A9B1E4B7CE185A8211B0F91CBF04C086DAA921F254B5C9A92FA1023D2AB4A472EFD524321D8D1920CCF9CE339BC11ED4FFE7CAC886503461B6CE9CD528
Y:
0x13035892703E33CEA75C2E437444D5EC1E9CE5F1473442760A1C3EB34A15331EC6AF6673F5287C20FEE84B5193CD784214DAFF55AD09737E7A724AE18F8D2E1DA5EB1CB33A7F0B33D001EBD003C2F60D550EC6DC71ADD68457A5F34EEE10031875885622670DC9541E0F2DD5472B04A3C3AA5BA0EA856DFCA6CC862DA216EE1B
Key ID: 0xF77801127F715726

and the self-sigature made by that key identifies itself by a the same
correct keyID.

So a couple of problems:

- is pgp-6.5.8 using the keyID field on secret key packets
  for something else (checksum?), or is it a bug?

- rfc2440 does not mention the keyID which is part of the secret key and
  public key packets.  If you look in sections 5.5.2 and 5.5.3 there appears
  to be no mention of the keyID.  This seems like an error in the RFC.

(I was testing with gnuPG 1.0.4 also, and it seems to do the right thing.)

Adam

---

From: Adam Back <[email-masked]>
Date: Fri, 23 Mar 2001 23:45:07 -0400

> (I was testing with gnuPG 1.0.4 also, and it seems to do the right thing.)

actually it looks like gnuPG does the same thing as PGP.

I'm presuming the keyID includes the private key components for private
keys, so the private key has a different keyID even though the gui doesn't
display it that way, if you display the contents of the private key file.

So I guess you have to compute the keyID rather than reading it in form the
secret key file if you're working from a secret key and not a public key.

Adam