trim iv in STD_encapsulate
This commit is contained in:
parent
73876e5774
commit
e793fc9973
@ -35,6 +35,7 @@ class Permissions {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static public function version() {
|
static public function version() {
|
||||||
|
// This must match the version in PermissionRoles.php before permission updates can run.
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,11 +67,13 @@ function AES128CBC_decrypt($data,$key,$iv) {
|
|||||||
|
|
||||||
function STD_encrypt($data,$key,$iv) {
|
function STD_encrypt($data,$key,$iv) {
|
||||||
$key = substr($key,0,32);
|
$key = substr($key,0,32);
|
||||||
|
$iv = substr($iv,0,16);
|
||||||
return openssl_encrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
|
return openssl_encrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function STD_decrypt($data,$key,$iv) {
|
function STD_decrypt($data,$key,$iv) {
|
||||||
$key = substr($key,0,32);
|
$key = substr($key,0,32);
|
||||||
|
$iv = substr($iv,0,16);
|
||||||
return openssl_decrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
|
return openssl_decrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user