Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

According to http://www.pgp.net/pgpnet/pgp-faq/pgp-faq-keys.html#key-public-key-forgery, key ID is some lower bits sequence from the modulus (i.e. the $n$ variable):

A PGP key ID is just the bottom 64 bits of the public modulus (but only the bottom 32 bits are displayed with pgp -kv).

I have a key pair. According to pgpdump, my key ID (i.e. 64b) is the following one 0x6BA09C369E31148C. According to GPG, my key ID (i.e. 32b) is the following one: 0x9E31148C. Well, this is just the last 32 bits from the 64b key ID.

I'd like to see a relation to my public modulus. I haven't found any, even if I play with endianess.

The key id is also weird… if it was last 32b (or 64b) from the modulus, it should be an odd number (except if $p$ == $2$ || $q == 2$$, which is very unlikely).

However, when I search lower 32 bits in my modulus (dumped by pgpdump), I see 0x84cfe5c1, which is far different from 0x9E31148C:

RSA n(4096 bits) - c8 1a 2e 7d e5 22 84 5c 10 b9 02 3b 42 ff 09 4c 60 f9 8a ce 80 64 8a 95 6a 0e 53 23 a3 dc fb fb f5 96 c7 a2 de be a9 f0 c8 f8 d8 51 
6d e8 bc 64 13 16 5e 25 f9 4d 44 bc 51 ef 7f 97 b4 05 a3 d9 9e e3 58 ef 88 c1 bb e5 23 65 45 1b 99 7b 68 c1 e4 1a 7d bc fb 51 c1 41 d6 10 33 34 90 c3 91 5c 5b 
ae 48 63 4e 65 46 4e 35 8e 48 e6 85 e3 9b ff b2 4b e9 c6 aa f1 45 3f b8 b6 b5 be 56 f8 04 4e 1d 1a d4 78 4d 75 fa 5e aa 2d 6d dc 31 2b c8 28 db cb 10 34 1a 16 
2c fd e2 67 e7 1d 0b e6 cc 53 92 5d 85 40 57 5c 9f 23 bb af 75 d9 11 2b 4a a0 6c ef c4 50 85 eb 79 46 b2 f7 03 54 8a c9 15 c0 ac d8 d4 5a 7c 5e 37 5e cc f2 13 
8a 67 3c 1f 26 c5 f4 11 d0 38 19 9c 34 0f c0 3d e7 63 67 8e 3f 7d 82 2e b6 59 d3 da 74 61 68 1c 78 7b 4c ce c3 5a f0 18 8c 3b ab 3c 88 03 28 6b 93 f5 b9 eb eb 
44 51 a7 b8 34 08 e9 a7 fa 81 d3 af 3d a0 f7 fa 6b f9 fb 98 97 38 32 d1 1f e4 e7 1a 4d af e3 e9 87 f8 ca b1 10 91 e5 9c fc db 4b 2d 23 3a 3f c3 fc 1b fe 15 c1 
df ff a2 0e fb 51 fe c3 1c 67 26 f3 f3 9d 50 ff 8b a7 48 f4 57 1c e8 63 e9 1e 1b 4a 27 96 02 9c 06 5a 62 ed 99 80 02 13 b2 31 66 a8 ee 79 15 85 05 61 81 67 0f 
b7 c6 4e d9 5f 31 81 64 d7 16 13 a8 70 a5 26 6f dc c3 cd f7 d3 8a 3d ab 79 60 34 6d 4e 9b f7 ef 32 eb 65 75 63 f4 79 1c 43 a8 ae 64 53 fd 56 77 d4 df 68 1e b6 
05 b0 d1 1d 7c fc 10 5a a3 aa eb 90 90 a8 6d 15 a6 8c 03 85 97 7b 0f 15 fe 19 07 ff 12 ff 10 87 fe bb 85 7b d3 98 34 24 8e c0 cb 5f 9a 42 81 71 76 3c fc 2d fb 
55 40 98 56 b0 b6 bd 26 8d bd 66 86 9a b2 49 cf a8 0f 4d 3c ed 62 34 79 4f 98 bd 5c 73 dc e5 45 cf 3f e0 a6 4a 59 e2 09 84 cf e5 c1 

Where is the mistake in understanding the Key ID?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

It depends on the version of the GPG format. In V3 the Key ID it is indeed the bottom 64 bits of the modulus, but in V4 it's the bottom 64 bits of the key fingerprint, which in turn is the "SHA-1 hash of the octet 0x99, followed by the two-octet packet length, followed by the entire Public-Key packet starting with the version field" according to the RFC.

share|improve this answer
    
That seems correct, because my kwy fingerprint is 831A 3FAC 3F17 798A 4590 7186 6BA0 9C36 9E31 148C. Thank you very much. Extra thanks for the link to the documentation. –  v6ak Sep 30 '13 at 20:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.