protected static function getDecrypt($encrypted) { $private_key = config('wx.merchantPrivateKeyFilePath'); //商户私钥 如果是路劲,可以使用file_get_content来获取 $pi_key = openssl_pkey_get_private($private_key);//这个函数可用来判断私钥是否是可用的,可用返回资源id Resource id if (empty($pi_key)) throw new Exception('无法获取私钥'); $decrypted = ''; //私钥解密 if ( openssl_private_decrypt(base64_decode($encrypted),$decrypted,$pi_key, OPENSSL_PKCS1_OAEP_PADDING)) { return $decrypted; } else { throw new Exception('解密失败'); } }
标签:decrypted,pi,私钥,微信,解密,private,v3,key,PHP From: https://www.cnblogs.com/bkhdd/p/17756285.html