aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-12-01 18:14:20 -0800
committerzotlabs <mike@macgirvin.com>2016-12-01 18:14:20 -0800
commit7f730b81ffe47b9423b9491970730348f87d5113 (patch)
treef23c51dae6669cbfc39793b471dae1b5edb6dcbc /include/crypto.php
parente793fc9973a763b14f1f6cddb425cd5c41aa799c (diff)
downloadvolse-hubzilla-7f730b81ffe47b9423b9491970730348f87d5113.tar.gz
volse-hubzilla-7f730b81ffe47b9423b9491970730348f87d5113.tar.bz2
volse-hubzilla-7f730b81ffe47b9423b9491970730348f87d5113.zip
trim both key and iv on other ciphers
Diffstat (limited to 'include/crypto.php')
-rw-r--r--include/crypto.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/crypto.php b/include/crypto.php
index df4347f22..f75390985 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -57,11 +57,13 @@ function AES256CBC_decrypt($data,$key,$iv) {
function AES128CBC_encrypt($data,$key,$iv) {
$key = substr($key,0,16);
+ $iv = substr($iv,0,16);
return openssl_encrypt($data,'aes-128-cbc',str_pad($key,16,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
}
function AES128CBC_decrypt($data,$key,$iv) {
$key = substr($key,0,16);
+ $iv = substr($iv,0,16);
return openssl_decrypt($data,'aes-128-cbc',str_pad($key,16,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0"));
}