小编use*_*183的帖子

C# 生成存折通行证签名文件

  1. App是通过C#生成通行证(Iphone中的Passbook App)。
  2. 我已经下载了Pass证书和AppleWWDRCA证书。
  3. 为了生成 pass,我可以生成 pass.json 和 manifest.json。
  4. 但是,当我使用签名证书和 manifest.json 生成 PKCS 7 分离签名文件时,iPhone 中的 Passbook 应用程序无法识别它。
  5. 我在 MAC 中使用 openssl 生成了分离的签名文件,该文件工作正常并安装在 Passbook 中。
  6. 我已经下载了pass证书和AppleWWDRCA证书
  7. 任何人都可以帮助我一步步在 C# 中创建签名文件的过程以及要使用的方法

我已将两个证书存储在本地文件夹中,而不是 Windows 本地存储中。我之前曾在 Windows 本地商店中尝试过,但没有成功。

以下是用于签名的方法,

 X509Certificate2 card = GetCertificate(); //Fetches the pass certificate   
X509Certificate2 appleCA = GetAppleCertificate();  //Fetches the AppleWWDRCA certificate    
    byte[] manifestbytes = Encoding.ASCII.GetBytes(manifest);
            ContentInfo contentinfo = new ContentInfo(manifestbytes);
            SignedCms signedCms = new SignedCms(contentinfo, true);
            var signer = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber,card);
            signer.Certificates.Add(new X509Certificate2(appleCA));
            signer.IncludeOption = X509IncludeOption.WholeChain;
            signer.SignedAttributes.Add(new Pkcs9SigningTime());
            signedCms.ComputeSignature(signer);
            signatureFile = …
Run Code Online (Sandbox Code Playgroud)

c# passbook

1
推荐指数
1
解决办法
4195
查看次数

Python 字符串“in”运算符

txt = "The rain in Spain stays mainly in the plain"
x = "ain" in txt
print(x) // True

txt = "The rain in Spain stays mainly in the plain "
x = " " in txt
print(x) // True

txt = "The rain in Spain stays mainly in the plain "
x = " " in txt.strip()

print(x) // True ,
Run Code Online (Sandbox Code Playgroud)

即使删除空格后它也是真实的。

python

-3
推荐指数
1
解决办法
131
查看次数

标签 统计

c# ×1

passbook ×1

python ×1