Skip to content

Cant decrypt on CLI #113

@Petah

Description

@Petah

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');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions