public static CertifiedPublicKey convertCertificate ( CertificateFactory certFactory , X509CertificateHolder cert ) { if ( cert == null ) { return null ; } if ( certFactory instanceof BcX509CertificateFactory ) { return ( ( BcX509CertificateFactory ) certFactory ) . convert ( cert ) ; } else { try { return certFactory . decode ( cert . getEncoded ( ) ) ; } catch ( IOException e ) { // Very unlikely throw new IllegalArgumentException ( "Invalid Certificate, unable to encode" , e ) ; } } }
Convert a Bouncy Castle certificate holder into a certified public key .