|
/

php解密一键登录的手机号失败,openssl_private_decrypt得到的是乱码

Ll*
发布于 4 年前
62151来自广东省
智能认证 U-Verify
API调用

php-code

$umPrivateKey = 'ios_key';
$aesEncryptKey = '友盟返回的aeskey';
$aesKey = '';
$rsaKey = "-----BEGIN PRIVATE KEY-----\n" . wordwrap($umPrivateKey , 64, "\n", true) . "\n-----END PRIVATE KEY-----";
$a= openssl_private_decrypt(base64_decode($aesEncryptKey), $aesKey, openssl_pkey_get_private($rsaKey));
var_dump($a);
var_dump($aesKey);
$ph= openssl_decrypt(base64_decode('手机号key'), 'AES-128-ECB', $aesKey);
var_dump($ph);

返回结果:


6个回答
 
3 年前
来自广东省

正确使用:openssl_decrypt('手机号key','AES-128-ECB',$aesKey);

 
4 年前
来自浙江省

你好,你是安卓还是ios呢

Loading ...
登录社区,分享你的经验