PHP.nl

openssl_decrypt

openssl_decrypt

Decrypts data

 **openssl_decrypt** string $data string $cipher_algo string $passphrase int $options string $iv  $tag string $aad

Takes a raw or base64 encoded string and decrypts it using a given method and passphrase.

dataThe encrypted message to be decrypted.

cipher_algo The cipher method. For a list of available cipher methods, use . openssl_get_cipher_methods

passphrase The passphrase. If the passphrase is shorter than expected, it is silently padded with characters; if the passphrase is longer than expected, it is silently truncated. NUL

Let op: > There is no key derivation function used for as its name might suggest. The only operation used is padding with characters or truncation if the length is different than expected. passphrase``NUL

options can be one of ,

    or .
   `options``OPENSSL_RAW_DATA``OPENSSL_ZERO_PADDING``OPENSSL_DONT_ZERO_PAD_KEY`

iv A non-null Initialization Vector. If the IV is shorter than expected, it is padded with characters and warning is emitted; if the passphrase is longer than expected, it is truncated and warning is emitted. NUL

tagThe authentication tag in AEAD cipher mode. If it is incorrect, the authentication fails and the function returns false.

Let op: > The length of the is not checked by the function. It is the caller's responsibility to ensure that the length of the tag matches the length of the tag retrieved when has been called. Otherwise the decryption may succeed if the given tag only matches the start of the proper tag. tag``openssl_encrypt

aadAdditional authenticated data.

The decrypted string on successreturn.falseforfailure.

Emits an level error if an unknown cipher algorithm is passed via the parameter. E_WARNING``cipher_algo

Emits an level error if an empty value is passed in via the parameter. E_WARNING``iv

openssl_encrypt