[guardian-dev] Format of exported subkeys from gnupg

Hans-Christoph Steiner hans at guardianproject.info
Fri Aug 3 18:01:47 EDT 2012



On 08/03/2012 05:45 PM, Abel Luck wrote:
> Abel Luck:
>> Perfect :) Thanks for this dkg. I'm 95% of the way there now.
> 
> Alright folks. I've implemented SecretKey and SecretSubkey parsing in
> python-pgpdump.
> 
> You can access all header data for these packets, and if they are not
> protected you can also access the secret key material.
> 
> At some future date we'll be integrating this into our OTR fileconverter
> utility, with the end goal of keeping your OTR key in your PGP keyring
> as a subkey for central identity management.
> 
> Code: https://github.com/abeluck/python-pgpdump
> 
> Example usage:
> 
> import pgpdump as pgp
> 
> # secret-subkeys.gpg was exported from gpg using:
> # --export-options export-reset-subkey-passwd,export-minimal
> --export-secret-subkeys KEYID
> 
> with open('secret-subkeys.gpg', 'rb') as fileobj:
>     rawdata = fileobj.read()
> 
> data = pgp.BinaryData(rawdata)
> packets = list(data.packets())
> for packet in packets:
>     if isinstance(packet, pgp.packet.SecretSubkeyPacket):
>         print "Subkey type: ", packet.pub_algorithm_type
> 
>         # for RSA keys
>         print "Prime p: ", packet.prime_p
>         print "Prime q: ", packet.prime_q
>         print "Multi Inv u:", packet.multiplicative_inverse
> 
> Thanks [Tom, Werner, dkg, Hans] for the advice.
> 
> ~abel

This is great!  This puts us very close to being able to use subkeys of
your GPG key as an OTR key!

.hc


More information about the Guardian-dev mailing list