Using Javascript and openpgp.js, how can I read private key from text and produce public key?
I'm trying to allow user to input their private PGP key to textbox and using data in that textbox (and passphrase) produce public PGP KEY text.
So far I've managed to read the private key using:
var privateKey = openpgp.key.readArmored(document.getElementById('privkeybox').value).keys[0];
privateKey.decrypt(passphrase);
I've also found the mysterious privateKey.toPublic(privateKey);
function, however, I can't seem to get the whole thing going (produce the BEGIN PUBLIC PGP KEY
- line).
If it does affect at all, this is done in browser.