mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-25 19:20:29 +08:00
workaround for openssl using base64 input to decrypt function
This commit is contained in:
@@ -69,8 +69,6 @@ class Security extends Component
|
|||||||
*/
|
*/
|
||||||
public $passwordHashStrategy = 'crypt';
|
public $passwordHashStrategy = 'crypt';
|
||||||
|
|
||||||
private $_cryptModule;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypts data using a password.
|
* Encrypts data using a password.
|
||||||
@@ -217,8 +215,8 @@ class Security extends Component
|
|||||||
|
|
||||||
$ivSize = 16;
|
$ivSize = 16;
|
||||||
$iv = StringHelper::byteSubstr($data, 0, $ivSize);
|
$iv = StringHelper::byteSubstr($data, 0, $ivSize);
|
||||||
$encrypted = StringHelper::byteSubstr($data, $ivSize, null);
|
$encrypted = base64_encode(StringHelper::byteSubstr($data, $ivSize, null));
|
||||||
$decrypted = openssl_decrypt($encrypted, $this->opensslCipher(), $key, OPENSSL_RAW_DATA, $iv);
|
$decrypted = openssl_decrypt($encrypted, $this->opensslCipher(), $key, OPENSSL_ZERO_PADDING, $iv);
|
||||||
|
|
||||||
return $this->stripPadding($decrypted);
|
return $this->stripPadding($decrypted);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user