dotnet-passbook中ComputerSignature失败的原因

时间:2016-05-11 20:53:55

标签: c# certificate signing passbook

从github,dotnet-passbook运行代码(更新指纹以匹配我的)

CmsSigner signer = new CmsSigner(SubjectIdentifierType.SubjectKeyIdentifier, passCert)
            {
                IncludeOption = X509IncludeOption.None
            };
            signer.Certificates.Add(passCert);
            signer.Certificates.Add(appleCert);
            signer.SignedAttributes.Add(new Pkcs9SigningTime());

            Trace.TraceInformation("Processing the signature..");
       //fails on the next line
            signing.ComputeSignature(signer);

我收到以下错误:

Data: {System.Collections.ListDictionaryInternal}
HResult: -2146893811
HelpLink: null
IPForWatsonBuckets: {1687357764}
InnerException: null
IsTransient: false
Message: "Key does not exist.\r\n"
RemoteStackTrace: null
Source: "System.Security"
StackTrace: "   at System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature(CmsSigner signer, Boolean silent)\r\n   at Passbook.Generator.PassGenerator.SignManifestFile(PassGeneratorRequest request) in D:\\git\\dotnet-passbook\\Passbook.Generator\\PassGenerator.cs:line 261"
TargetSite: {Void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner, Boolean)}

我发现其他地方引用了Net4.0的一些漏洞。

  • 所有证书仍然有效(而非空)
  • 所有证书均来自apple

快速了解原因?

1 个答案:

答案 0 :(得分:2)

我是dotnet-passbook的作者,所以我会尽力帮助:)

这通常是由证书中缺少私钥引起的。导出它们时,必须确保包含私钥组件。这是实际签署清单所必需的。

我希望有所帮助。