public static CertifiedPublicKey getCertificate ( CertificateProvider provider , SignerInformation signer , CertificateFactory factory ) { SignerId id = signer . getSID ( ) ; if ( provider instanceof BcStoreX509CertificateProvider ) { X509CertificateHolder cert = ( ( BcStoreX509CertificateProvider ) provider ) . getCertificate ( id ) ; return ( cert != null ) ? BcUtils . convertCertificate ( factory , cert ) : null ; } X500Name bcIssuer = id . getIssuer ( ) ; BigInteger serial = id . getSerialNumber ( ) ; byte [ ] keyId = id . getSubjectKeyIdentifier ( ) ; if ( bcIssuer != null ) { PrincipalIndentifier issuer = new DistinguishedName ( bcIssuer ) ; if ( keyId != null ) { return provider . getCertificate ( issuer , serial , keyId ) ; } return provider . getCertificate ( issuer , serial ) ; } if ( keyId != null ) { return provider . getCertificate ( keyId ) ; } return null ; }
Retrieve the certificate matching the given signer from the certificate provider .