diff options
Diffstat (limited to 'include/crypto.php')
-rw-r--r-- | include/crypto.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/crypto.php b/include/crypto.php index f75390985..bcbb3d388 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -79,6 +79,19 @@ function STD_decrypt($data,$key,$iv) { return openssl_decrypt($data,'aes-256-cbc',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,16,"\0")); } +function AES256GCM_encrypt($data,$key,$iv) { + $key = substr($key,0,32); + $iv = substr($iv,0,12); + return openssl_encrypt($data,'aes-256-gcm',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,12,"\0")); +} + +function AES256GCM_decrypt($data,$key,$iv) { + $key = substr($key,0,32); + $iv = substr($iv,0,12); + return openssl_decrypt($data,'aes-256-gcm',str_pad($key,32,"\0"),OPENSSL_RAW_DATA,str_pad($iv,12,"\0")); +} + + function CAST5CBC_encrypt($data,$key,$iv) { $key = substr($key,0,16); $iv = substr($iv,0,8); |