I have now implemented this method and added extractPublicKey() to the
private key in this pull request:
https://github.com/openpgpjs/openpgpjs/pull/53

For private keys exported with GPG or generated with OpenPGP.js this
extracts a valid public key.
Private keys exported with PGP do not contain any signatures, therefore
it's not possible to create a public
key and null is returned.

Thomas


On Fri, Aug 31, 2012 at 11:50 AM, Thomas Oberndörfer <[email protected]>wrote:

>
> Hi,
>
> I have an armored private key and I want to extract from this an armored
> public key.
> Had a look openpgp.generate_key_pair which shows a way how to do that. But
> for calling
> signature.write_message_signature the private key needs to be unlocked.
>
> Little bit of background:
> If a private key is imported in GPG it is ignored as the public key is
> missing.
> PGP Desktop handles that differently: you can import a private key and it
> is displayed as key pair
> in your keyring. On export a file with public and private part is created.
> This can be done without
> unlocking the private key. So I think it should be possible to extract a
> public key from a private one
> without unlocking. I like the flexibility of importing single private keys.
>
> Any ideas?
>
> Thanks, Thomas
>
_______________________________________________

http://openpgpjs.org

Reply via email to