简体   繁体   中英

Getting X509 Certificate from Signed envelop data

I want to convert following Java code into iOS. Please help me out.

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 );
}

Here in Java extracting X509 Certificate from Signed Info. How to achieve same thing in iOS?

Check out CMSDecoder.h in the Security.framework. That plus the openssl framework you get you started.

WRONG
The Cryptographic Message Syntax API is not public on iOS. I guess it's openssl all the way. Sorry!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM