Tag Archives: Programming techniques

[wechat Payment] use OpenSSL command to generate apicclient_ key.pem Error report URL error 58

Problem description
At present, there are only files apiclient_cert.p12 in the development group, but PHP projects need apiclient_cert.pem and apiclient_key.pem as the certificate of refund operation
After WeChat payment document at https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?Chapter = command in 4_3

openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem

After the operation, the exported file should not only enter the merchant ID as the password, but also set the password
And after importing the project, the project reports an error cURL error 58
The solution
The exported command is corrected to

openssl pkcs12 -nodes -clcerts -in apiclient_cert.p12 -out apiclient_key.pem