Home » » openssl_public_encrypt

openssl_public_encrypt

Written By 1 on Tuesday, October 2, 2012 | 10:21 AM

bool openssl_public_encrypt ( string $data , string &$crypted , mixed $key [, int $padding = OPENSSL_PKCS1_PADDING ] )
Encrypts data with public key
openssl_public_encrypt() encrypts data with public key and stores the result into crypted. Encrypted data can be decrypted via openssl_private_decrypt().

The confusion most have seems to be on "mixed $key"





The $key is explained in, and mostly the same as the parameter of http://www.php.net/manual/en/function.openssl-pkey-get-public.php




It can take the resource $key returned from openssl_pkey_get_public() OR find the value is text and passes the text to openssl_pkey_get_public() to get a valid resource.

 

0 Comment:

Post a Comment