Closed thevalo closed 3 years ago
Dont use this line
$wkey = $wkey[0];
$wkey = OpenPGP_Message::parse(file_get_contents('sec.asc'));
This line is almost certainly wrong, since it seems the .asc
extension means it will be an ASCII armored key and not just a binary key. You want this:
$wkey = OpenPGP_Message::parse(OpenPGP::unarmor(file_get_contents('sec.asc'), 'PGP PRIVATE KEY BLOCK'));
Hello, I'm trying example
sign.php
with just replacing this line:$wkey = OpenPGP_Message::parse(file_get_contents('sec.asc'));
wheresec.asc
is a secret key, without password-protection, however when opening it this error appears:Fatal error: Uncaught Error: Cannot use object of type OpenPGP_LiteralDataPacket as array in C:\xampp\htdocs\openpgp-php\lib\openpgp_crypt_rsa.php:25 Stack trace: #0 C:\xampp\htdocs\openpgp-php\examples\sign.php(15): OpenPGP_Crypt_RSA->__construct(Object(OpenPGP_LiteralDataPacket)) #1 {main} thrown in C:\xampp\htdocs\openpgp-php\lib\openpgp_crypt_rsa.php on line 25
Any idea why this would happen?