我尝试使用mac上的证书创建签名:
$pkcs12 = file_get_contents($this->certPath);
$certs = array();
if(openssl_pkcs12_read($pkcs12, $certs, $this->certPass) == true) {
$certdata = openssl_x509_read($certs['cert']);
$privkey = openssl_pkey_get_private($certs['pkey'], $this->certPass );
openssl_pkcs7_sign($paths['manifest'], $paths['signature'], $certdata, $privkey, array(), PKCS7_BINARY | PKCS7_DETACHED);
$signature = file_get_contents($paths['signature']);
$signature = $this->convertPEMtoDER($signature);
file_put_contents($paths['signature'], $signature);
return true;
}
但它给了我:
警告:openssl_x509_read():提供的参数无法被强制 进入X509证书!
我发现有人说这是UTF-8 BOM问题,但在这种情况下不是问题,我该怎么办?
谢谢!