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

标签 php ios ssl passbook

嗨,我是 ios 7 和 php 的新手 我一直在努力做这个PHP-PKPass Class与 ios 7 一起工作 它与我的 Safari 浏览器一起工作正常 当我尝试下载包以将其添加到我的存折时,我可以看到票证 safari 告诉我“无法下载文件” 这是它有 sample running with my certificates 的链接 我查看了电话记录,上面写着:

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

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

任何人都可以帮助将通过 php 使用 S/MIME signing-time 属性对通行证进行签名的日期和时间添加到当前的 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;
            }
    }

最佳答案

尝试将您的证书和 key 作为文件引用传递。例如

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

关于PHP-PKPass 不适用于 iOS 7 添加使用 PHP 中的 S/MIME signing-time 属性对通行证进行签名的日期和时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20072793/

相关文章:

ssl - 为什么对 TLS 使用标准 dhparam 值

java - 运行简单 SSL Java 示例时出现 SSLHandshakeException

php - 如何使用 php if ($text like %admin%) 搜索文本

php - 三表多选

php - Ajax 返回值与 PHP 结合使用

objective-c - 用于在 Core Data 中执行计算的链式表达式

bash - 将文本文件中的额外列拆分为单独的行(保留第一列)

php - 使用 PHPUnit 测试数组是否包含值

ios - 键盘底角图标在iOS中改变颜色

iphone - SocketException 未被用户代码处理