Closed diegoot-dev closed 3 years ago
Hi, i have a decryption issue:
Fatal error: Uncaught Exception: Data is already unencrypted in D:\wamp64\www\openpgp-php\lib\openpgp_crypt_symmetric.php on line 177
This is my code:
function decryptJson($message){
$msgASCII = $message; $keyASCII = file_get_contents(dirname(__FILE__) . '/../keys/privateKey.txt'); $keyEncrypted = OpenPGP_Message::parse(OpenPGP::unarmor($keyASCII, 'PGP PRIVATE KEY BLOCK')); var_dump($keyEncrypted); foreach($keyEncrypted as $p) { if(!($p instanceof OpenPGP_SecretKeyPacket)) continue; $key = OpenPGP_Crypt_Symmetric::decryptSecretKey("test", $p); $msg = OpenPGP_Message::parse(OpenPGP::unarmor($msgASCII, 'PGP MESSAGE')); $decryptor = new OpenPGP_Crypt_RSA($key); $decrypted = $decryptor->decrypt($msg); }
}
The error occurs because there are some null values in the Packet. Why does that happen?
The keys, encryption and decryption works fine in others projects with JAVA or Javascript.
Thanks!
Those NULL are fine. This exception only occurs when trying to decrypt data or key this is not actually encrypted. Could you post an example of data and key that produce this error for you?
Hi, i have a decryption issue:
Fatal error: Uncaught Exception: Data is already unencrypted in D:\wamp64\www\openpgp-php\lib\openpgp_crypt_symmetric.php on line 177
This is my code:
function decryptJson($message){
}
The error occurs because there are some null values in the Packet. Why does that happen?
The keys, encryption and decryption works fine in others projects with JAVA or Javascript.
Thanks!