在签名C#中包含中间证书

时间:2012-09-14 15:57:23

标签: c# ssh x509certificate2 smime passbook

我正在尝试使用c#签署要在Passbook中使用的清单文件。我的代码做得很好,直到他们发布了iOS6的GM。在这个种子中,他们希望签名包含intemidiate证书。这是我的代码:

var dataToSign = System.IO.File.ReadAllBytes(filePathToSign);
ContentInfo contentInfo = new ContentInfo(new Oid("1.2.840.113549.1.7.2"), dataToSign);

var signerCert = new X509Certificate2(signerPfxCertPath, signerPfxCertPassword);

var signedCms = new SignedCms(contentInfo, true);

var signer = new CmsSigner(signerCert);
signer.IncludeOption = X509IncludeOption.ExcludeRoot;

signedCms.ComputeSignature(signer);

var myCmsMessage = signedCms.Encode();

return myCmsMessage;

我的机器上安装了证书,但它不起作用。我缺少什么想法?

1 个答案:

答案 0 :(得分:0)

正如评论中提到的(感谢Rudi):

  

Blockquote look herehere

相关问题