|
@@ -168,22 +168,28 @@ class Api
|
|
|
{
|
|
|
if ($data) {
|
|
|
//手机号/微信号 私钥加密
|
|
|
- $private_key = "-----BEGIN RSA PRIVATE KEY-----" .PHP_EOL.
|
|
|
- wordwrap(config('private_key'), 64, PHP_EOL, true) .
|
|
|
- PHP_EOL."-----END RSA PRIVATE KEY-----";
|
|
|
+// $private_key = "-----BEGIN RSA PRIVATE KEY-----" .PHP_EOL.
|
|
|
+// wordwrap(config('private_key'), 64, PHP_EOL, true) .
|
|
|
+// PHP_EOL."-----END RSA PRIVATE KEY-----";
|
|
|
+ $public_key = "-----BEGIN PUBLIC KEY-----" .PHP_EOL.
|
|
|
+ wordwrap(config('public_key'), 64, PHP_EOL, true) .
|
|
|
+ PHP_EOL."-----END PUBLIC KEY-----";
|
|
|
if (isset($data['mobile']) && $data['mobile']) {
|
|
|
$mobile = "";
|
|
|
- openssl_private_encrypt($data['mobile'], $mobile, $private_key); // 使用私钥加密数据
|
|
|
+// openssl_private_encrypt($data['mobile'], $mobile, $private_key); // 使用私钥加密数据
|
|
|
+ openssl_public_encrypt($data['mobile'], $mobile, $public_key);
|
|
|
$data['mobile'] = base64_encode($mobile);
|
|
|
}
|
|
|
if (isset($data['wechat']) && $data['wechat']) {
|
|
|
$wechat = "";
|
|
|
- openssl_private_encrypt($data['wechat'], $wechat, $private_key); // 使用私钥加密数据
|
|
|
+// openssl_private_encrypt($data['wechat'], $wechat, $private_key); // 使用私钥加密数据
|
|
|
+ openssl_public_encrypt($data['wechat'], $wechat, $public_key);
|
|
|
$data['wechat'] = base64_encode($wechat);
|
|
|
}
|
|
|
if (isset($data['wechat_auth']) && $data['wechat_auth']) {
|
|
|
$wechat_auth = "";
|
|
|
- openssl_private_encrypt($data['wechat_auth'], $wechat_auth, $private_key); // 使用私钥加密数据
|
|
|
+// openssl_private_encrypt($data['wechat_auth'], $wechat_auth, $private_key); // 使用私钥加密数据
|
|
|
+ openssl_public_encrypt($data['wechat_auth'], $wechat_auth, $public_key);
|
|
|
$data['wechat_auth'] = base64_encode($wechat_auth);
|
|
|
}
|
|
|
}
|