Gnupg file formats

Thomas Martin toskp10 at
Thu Dec 1 10:02:22 CET 2011

Hello all,

I'm interested in learning more about how cryptography is applied, and
I'm trying to understand the file formats used by Gnupg. The RFC4880
has been a great help. In looking at an private key I can find the
MPI's for the public and private parameters. In looking at a
ciphertext, I can find the Key ID and the RSA encrypted symmetric key.
What I'm struggling with is the first few characters of the files. Why
does a 1024 RSA private key start with the three bytes \x9501D8? Why
does a 2048 bit key start with the four bytes \x99010D04? Why does a
ciphertext encrypted with a 1024 bit RSA key start \x848C03? Why is it
\x85010C03 for 2048 bit RSA? Is this explained in the RFC somewhere
I've missed or is it documented elsewhere?

Any help would be appreciated.


More information about the Gnupg-users mailing list