We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
composer require phpseclib/phpseclib
use phpseclib3\Crypt\AES; # 加密 $aesKey= md5(uniqid(rand(), true)); $iv = self::IV; // AES加密 $aes = new AES('CBC'); $aes->setKey($aesKey); $aes->setIV($iv); $dataJson = is_array($data) ? json_encode($data, JSON_THROW_ON_ERROR) : $data; $encode = $aes->encrypt($dataJson); $encodeStr = strtoupper(bin2hex($encode)); # 解密 $iv = self::IV; $data = hex2bin(strtolower($data)); // AES解密 $aes = new AES('CBC'); $aes->setKey($aesKey); $aes->setIV($iv); $encode = $aes->decrypt($data);
# 加密 public static function RsaEncode($publicKey, $data, $padding = RSA::ENCRYPTION_OAEP){ $key = PublicKeyLoader::load(file_get_contents($publicKey), $password); $key->withPadding($padding); return base64_encode($key->encrypt($data)); } public static function RsaDecode($privateKey, $data, $padding = RSA::ENCRYPTION_OAEP){ $key = PublicKeyLoader::load(file_get_contents($privateKey), $password); $key->withPadding($padding); return $key->decrypt(base64_decode($data)); } # 解密
composer require ch4o5/sm3-php
$sm3 = sm3('abc');
有的时候客户发的是p12 证书 可以去网站 上转换
The text was updated successfully, but these errors were encountered:
No branches or pull requests
AES
RSA
SM3
证书转换
有的时候客户发的是p12 证书 可以去网站 上转换
The text was updated successfully, but these errors were encountered: