我想将以下Java代码转换为iOS。请帮帮我。
CMSSignedDataParser sp = new CMSSignedDataParser(new JcaDigestCalculatorProviderBuilder().setProvider("BC").build(), contents.getBuffer());
sp.getSignedContent().drain();
Store certStore = sp.getCertificates();
SignerInformationStore signers = sp.getSignerInfos();
Collection c = signers.getSigners();
Iterator it = c.iterator();
while (it.hasNext())
{
SignerInformation signer = (SignerInformation)it.next();
Collection certCollection = certStore.getMatches(signer.getSID());
Iterator certIt = certCollection.iterator();
X509CertificateHolder cert = (X509CertificateHolder)certIt.next();
X509Certificate certificate = new JcaX509CertificateConverter().setProvider( "BC" ).getCertificate( cert );
}
这里用Java从签名信息中提取X509证书。如何在iOS中实现相同的功能?
答案 0 :(得分:0)
在Security.framework中查看CMSDecoder.h
。加上openssl框架,你就可以开始了。
<强> WRONG 强>
Cryptographic Message Syntax
API在iOS上不公开。我想它一直都是openssl。遗憾!