public static function LockrAesCbcKeyWrapper::decrypt in Lockr 7.2
Same name and namespace in other branches
- 7.3 vendor/lockr/lockr/src/KeyWrapper/LockrAesCbcKeyWrapper.php \Lockr\KeyWrapper\LockrAesCbcKeyWrapper::decrypt()
Decrypt the given ciphertext using encoded.
Parameters
string $ciphertext:
string $encoded:
Return value
string|bool
Overrides KeyWrapperInterface::decrypt
File
- vendor/
lockr/ lockr-client/ src/ KeyWrapper/ LockrAesCbcKeyWrapper.php, line 43
Class
Namespace
Lockr\KeyWrapperCode
public static function decrypt($ciphertext, $encoded) {
$parts = self::decode($encoded);
if (!$parts) {
return false;
}
list($cipher, $mode, $iv, $key) = $parts;
$ciphertext = base64_decode($ciphertext);
$key = mcrypt_decrypt($cipher, $key, $ciphertext, $mode, $iv);
if ($key === false) {
return false;
}
return trim($key);
}