Webiny\Component\Crypt\Crypt::decrypt PHP Méthode

decrypt() public méthode

In order to decrypt the string correctly, you must provide the same secret key that was used for the encryption process.
public decrypt ( string $string, string $key ) : string
$string string The string you want to decrypt.
$key string The secret key that was used to encrypt the $string.
Résultat string Decrypted string or false if unable to decrypt (wrong key).
    public function decrypt($string, $key)
    {
        try {
            return $this->driverInstance->decrypt($string, $key);
        } catch (\Exception $e) {
            throw new CryptException($e->getMessage());
        }
    }

Usage Example

Exemple #1
0
 /**
  * Decrypts the given $string that was encrypted with the $key.
  *
  * @param string $string Encrypted string.
  * @param string $key    Key used for encryption.
  *
  * @return string Decrypted string.
  */
 public function decrypt($string, $key)
 {
     return $this->serviceInstance->decrypt($string, $key);
 }
All Usage Examples Of Webiny\Component\Crypt\Crypt::decrypt