@ SuppressWarnings ( "unchecked" ) public List < CertificateMeta > parse ( ) throws CertificateException { CMSSignedData cmsSignedData ; try { cmsSignedData = new CMSSignedData ( data ) ; } catch ( CMSException e ) { throw new CertificateException ( e ) ; } Store < X509CertificateHolder > certStore = cmsSignedData . getCertificates ( ) ; SignerInformationStore signerInfos = cmsSignedData . getSignerInfos ( ) ; Collection < SignerInformation > signers = signerInfos . getSigners ( ) ; List < X509Certificate > certificates = new ArrayList <> ( ) ; for ( SignerInformation signer : signers ) { Collection < X509CertificateHolder > matches = certStore . getMatches ( signer . getSID ( ) ) ; for ( X509CertificateHolder holder : matches ) { certificates . add ( new JcaX509CertificateConverter ( ) . setProvider ( provider ) . getCertificate ( holder ) ) ; } } return CertificateMetas . from ( certificates ) ; }
get certificate info