singpolyma / openpgp-php

OpenPGP.php is a pure-PHP implementation of the OpenPGP Message Format (RFC 4880).
http://singpolyma.github.io/openpgp-php/
The Unlicense
180 stars 69 forks source link

pgp_keygen.php with passphrase protected private key #87

Closed michaelgracie closed 5 years ago

michaelgracie commented 5 years ago

Testing pgp_keygen.php produces expected results, including ASCII-armored key pairs that are acceptable to GPGMail. Cannot figure out how to output password protected private key though. Have tested a derivative using rsa->setPassword() which will output encrypted RSA private key, but no such success once hitting OpenPGP_SecretKeyPacket.

singpolyma commented 5 years ago

To do the reverse is here https://github.com/singpolyma/openpgp-php/blob/master/lib/openpgp_crypt_symmetric.php#L78 but I think no one has ever wanted to encrypt a secret key with the library before. It should not be too hard to add, based on the decrypt key code and the generic encrypt code, but is not there yet I think.

michaelgracie commented 5 years ago

Appreciate the response.