I have exported public and private keys to file with gpg --export and --export-secret-keys. When I examine them with gpg --list-packets. I can see that the file contains:

  • the actual key
  • the user ID
  • a signature packet

How can I extract only the actual key from the file? I would like end up with a PKCS8 private key file and a PublicKeyInfo(?) file that I can use programmatically.

  • Is this related to Export format of gpg? – a CVn Mar 26 '14 at 15:11
  • Yes, part of the same effort. To my understanding the site recommendations are not to ask several questions in one post, so I have separated these as individual questions. – Eero Aaltonen Mar 26 '14 at 18:01
  • That is absolutely correct, Eero. The reason for my asking that is that sometimes (many times), even when an effort can (and should!) be broken down into separate questions, having some idea of the overall goal can lead to better answers than looking only at the individual question-parts themselves. – a CVn Mar 27 '14 at 10:53

You may remove the passphrase and get the raw key material using gpgsplit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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