我刚刚创建了一个应用程序和一个传递,所以我可以将传递添加到iPod中的PassBook,但我无法通过电子邮件或Web服务器链接共享传递.从我从Apple读取的文档中,我需要添加一个MIME类型application/vnd.apple.pkpass.但是,我不清楚我应该采取什么措施.我不知道如何使用MIME类型.
我应该如何添加此MIME类型以便使用来自我的Web服务的传递?
我正在尝试将签名时间属性添加到我使用SignedCMS签名的文件中.
private byte[] signFile(byte[] fileContent, X509Certificate2 verificationCert)
{
ContentInfo contentInfo = new ContentInfo(fileContent);
SignedCms signedCMS = new SignedCms(contentInfo);
CmsSigner cmsSigner = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, verificationCert);
Oid signedDate = new Oid("1.2.840.113549.1.9.5"); //oid for PKCS #9 signing time
signedDate.Value = DateTime.Now.ToString();
CryptographicAttributeObject cryptoAtty = new CryptographicAttributeObject(signedDate);
cmsSigner.SignedAttributes.Add(cryptoAtty);
signedCMS.ComputeSignature(cmsSigner, false);
byte[] encoded = signedCMS.Encode();
return encoded;
}
Run Code Online (Sandbox Code Playgroud)
在Encode上抛出错误:
CryptographicException: The object identifier is poorly formatted.
Run Code Online (Sandbox Code Playgroud)
有关如何正确添加签名时间的任何想法?我想我可能必须将签名时间转换为ASN.1编码对象并将其添加到cryptoAtty值.如何将日期/时间转换为ASN.1编码对象?