We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
When trying to decrypt the output of this lib using gpg cli tool I get this:
$ gpg --decrypt test.enc gpg: assuming IDEA encrypted data gpg: [don't know]: indeterminate length for invalid packet type 2 gpg: WARNING: encrypted message has been manipulated! gpg: [don't know]: invalid packet (ctb=40)
This is the PHP code
$pk = OpenPGP_Message::parse(file_get_contents('public.asc')); $data = new OpenPGP_LiteralDataPacket("some text\n", ['format' => 'u']); $encrypted = OpenPGP_Crypt_Symmetric::encrypt([$pk], new OpenPGP_Message([$data])); echo OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE');
The text was updated successfully, but these errors were encountered:
The key itself needs to be un-armored and parsed
$pubkey = './test-public-key.asc'; $pk = OpenPGP_Message::parse(\OpenPGP::unarmor(file_get_contents($pubkey), 'PGP PUBLIC KEY BLOCK')); foreach ($pk->packets as $p) { if (!($p instanceof \OpenPGP_PublicKeyPacket)) { continue; } $publickeyPacket = $p; } $data = new OpenPGP_LiteralDataPacket("some text\n", ['format' => 'u']); $encrypted = OpenPGP_Crypt_Symmetric::encrypt([$publickeyPacket], new OpenPGP_Message([$data])); echo OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE');
Sorry, something went wrong.
No branches or pull requests
Hi,
When trying to decrypt the output of this lib using gpg cli tool I get this:
This is the PHP code
The text was updated successfully, but these errors were encountered: