Webiny\Component\Crypt\Crypt::encrypt PHP Method

encrypt() public method

Encrypt the given $string using a cypher and the secret $key
public encrypt ( string $string, string $key ) : string
$string string The string you want to encrypt.
$key string The secret key that will be used to encrypt the string.
return string Encrypted string.
    public function encrypt($string, $key)
    {
        try {
            return $this->driverInstance->encrypt($string, $key);
        } catch (\Exception $e) {
            throw new CryptException($e->getMessage());
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Encrypts the given $string using the $key variable as encryption key.
  *
  * @param string $string Raw string that should be encrypted.
  * @param string $key    Security key used for encryption.
  *
  * @return string Encrypted key.
  */
 public function encrypt($string, $key)
 {
     return $this->serviceInstance->encrypt($string, $key);
 }
All Usage Examples Of Webiny\Component\Crypt\Crypt::encrypt