Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

openpgp.js: generate public key text string from private key text string

$
0
0

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.


Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>