openssl_sign(): supplied key param cannot be coerced into a private key

PHP RSA 报错
openssl_sign(): supplied key param cannot be coerced into a private key

一般是私钥格式不正确,转换一下就好了。

openssl_sign(): supplied key param cannot be coerced into a private key_第1张图片
主要函数:

	chunk_split();
	
	"-----BEGIN RSA PRIVATE KEY-----\n$str-----END RSA PRIVATE KEY-----\n";

然后再重试

openssl_sign($data, $sign, $privateKey,‘sha256’)

还是不行的话再重新找解决方法。

你可能感兴趣的:(openssl_sign(): supplied key param cannot be coerced into a private key)