jeudi 20 juillet 2017

PHP OpenPGP encryption

PHP gnupg package is not updated with DLL and I cannot compile it for some reason, so I have to use http://ift.tt/1tEVmsj to encrypt a string with PGP Public key. What Am I currently doing:

$data = new OpenPGP_LiteralDataPacket($message);
    $encrypted = OpenPGP_Crypt_Symmetric::encrypt(
            $key,
            new OpenPGP_Message(array($data))
    );

  dd($encrypted);

here $message is a string and $key is made from public key like this:

$key = OpenPGP_Message::parse(
            OpenPGP::unarmor('PUBLIC KEY IS HERE', 'PGP PUBLIC KEY BLOCK')
        );

now code abowe works and when I do dd($encrypted) I'm left with an instance of OpenPGP_Message . Looked over example docs on GitHub but can't find a way to get a standard encrypted pgp message block.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2udBWhQ
via IFTTT

1 commentaire: