views:

67

answers:

2

i want to write a program in python to simply read pgp keys. however, i cant seem to find any documentation describing how pgp keys are formatted. i dont want to be searching through the source code of open pgp to look for source code that i wont be able to understand.

say i open a public key, remove the top "-----BEGIN PGP PUBLIC KEY BLOCK-----" and bottom "-----END PGP PUBLIC KEY BLOCK-----", and change the data back into bytes, then what? i saw my name and email somewhere in the middle, but i cant see anything else. which part tells the computer the cipher name/value (say rsa = 1, elgamal = 2, etc.) in the string? where is the key size? where is the time-the-key-is-valid-for? in general, how do pkc programs read the public/private keys?

+3  A: 

You can read the PGP RFCs (looks like the latest is RFC 4880). But why not use pyme instead?

Matthew Flaschen
A: 

i want to know what is going on, and not rely on other people all the time

calccrypto
This should be a comment, not an answer.
Ikke
GPG, GPGME, and pyme are all open source. You can learn as much or as little about their implementation as you want.
Matthew Flaschen
im inept at reading source codes
calccrypto