PHP PKPass不适用于iOS 7,请使用PHP中的S/MIME签名时间属性添加对通行证进行签名的日期和时间


PHP-PKPass Not working with iOS 7 add the date and time that the pass was signed using the S/MIME signing-time attribute in PHP

嗨,我是ios 7和php的新手我一直在尝试让这个PHP-PKPass类与ios 7一起使用,它与我的Safari浏览器配合得很好。当我尝试下载包将其添加到我的存折时,我可以看到票。Safari告诉我"无法下载文件"这是使用我的证书运行示例的链接我查看了电话日志,上面写着:

提供的passTypeIdentifier或teamIdentifier可能与您的证书不匹配,或者无法验证证书信任链。

我所有的证书都运行良好json是正确的,因为我可以在我的Mac上可视化它,到目前为止我所做的研究表明,包需要使用服务器日期时间进行签名,在ios 6中没有强制执行,但在ios 7 中强制执行

有人可以帮助将通过php使用S/MIME签名时间属性对通行证进行签名的日期和时间添加到当前php类中吗?

 protected function createSignature($manifest) {
            $paths = $this->paths();
            file_put_contents($paths['manifest'], $manifest);
            $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 );
                    if(!empty($this->WWDRcertPath)){
                            if(!file_exists($this->WWDRcertPath)){
                                    $this->sError = 'WWDR Intermediate Certificate does not exist';
                                    return false;
                            }
                            openssl_pkcs7_sign($paths['manifest'], $paths['signature'], $certdata, $privkey, array(), PKCS7_BINARY | PKCS7_DETACHED, $this->WWDRcertPath);
                    }else{
                            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;
            } else {
                    $this->sError = 'Could not read the certificate';
                    return false;
            }
    }

尝试将证书和密钥作为文件引用传入。例如

openssl_pkcs7_sign($paths['manifest'],
            $paths['signature'],
            'file://' . $certs['cert'],
            array('file://' . $certs['cert'], $this->certPass),
            array(),
            PKCS7_BINARY|PKCS7_DETACHED,
            $this->WWDRcertPath);

我创建了一个新的pass ID,生成了一个全新的p12证书,现在可以使用了!!!感谢您的帮助:)