经常做银行的支付接口,私钥一般都是pfx格式(私钥用来加密生成签名发送报文),公钥是cer格式(公钥用来验证返回报文里的签名).但是php里openssl只能用pem格式,每次转换都要用openssl命令在本地转好,很是麻烦.下面是直接php转换的代码. 私钥pfx转pem //filePath为pfx文件路径 function signfrompfx($strData,$filePath,$keyPass) { if(!file_exists($filePath)) { return fals…