openssl_pkcs7_sign():AppleWWDRCA.cer文件中没有证书

时间:2016-05-05 03:09:21

标签: php ios ssl digital-signature pkcs#7

我需要创建一个独立的PKCS7签名,用于Apple Wallet传递。

代码

private function createSignature()
{
    $cert = '/etc/ssl/local.crt';
    $key = '/etc/ssl/local.key';
    $wwdr = '/var/www/app/storage/passes/AppleWWDRCA.cer';
    $headers = [
        'signing-time' => (new DateTime())->format('o-m-d H:i:s'),
    ];

    return openssl_pkcs7_sign("$this->dir/manifest.json", "$this->dir/signature",
        $cert, $key, $headers, PKCS7_DETACHED, $wwdr);
}

错误

openssl_pkcs7_sign(): no certificates in file, /var/www/app/storage/passes/AppleWWDRCA.cer

AppleWWDRCA.cer已从https://www.apple.com/certificateauthority/下载。我下载的确切证书是WWDR Certificate (Expiring 02/07/23)。我查看了该文件并确认它不是空白。我错过了一步吗?

1 个答案:

答案 0 :(得分:4)

通过将AppleWWDR.cer添加到我的钥匙串并将其从钥匙串中导出为.pem文件来解决该问题。