dlh_test_server/vendor/icbc-api-sdk-cop-php/IcbcEncrypt.php
2024-08-03 10:04:14 +08:00

21 lines
674 B
PHP
Executable File

<?php
include_once 'AES.php';
include_once 'IcbcConstants.php';
class IcbcEncrypt{
public static function encryptContent($content, $encryptType, $encryptKey, $charset){
if(IcbcConstants::$ENCRYPT_TYPE_AES == $encryptType){
return AES::AesEncrypt($content,base64_decode($encryptKey));
}else{
throw new Exception("Only support AES encrypt!");
}
}
public static function decryptContent($encryptedContent, $encryptType, $encryptKey, $charset){
if(IcbcConstants::$ENCRYPT_TYPE_AES == $encryptType){
return AES::AesDecrypt($encryptedContent,base64_decode($encryptKey));
}else{
throw new Exception("Only support AES decrypt!");
}
}
}
?>