我已将两个证书存储在本地文件夹中,而不是 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) 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)
即使删除空格后它也是真实的。