java/src/main/java/com/genexus/security/web/jose/jwt/pem/X509CertUtils.java
/**
     * Parses a DER-encoded X.509 certificate.
     */
Parses a DER-encoded X.509 certificate.
Parses a DER - encoded X . 509 certificate .
public static X509Certificate parse(final byte[] derEncodedCert) {
        if (derEncodedCert == null || derEncodedCert.length == 0) {
            return null;
        }
        try {
            final CertificateFactory cf = CertificateFactory.getInstance("X.509");
            final Certificate cert = cf.generateCertificate(new ByteArrayInputStream(derEncodedCert));
            if (!(cert instanceof X509Certificate)) {
                return null;
            }
            return (X509Certificate) cert;
        } catch (CertificateException e) {
            return null;
        }
    }
public static X509Certificate parse ( final byte [ ] derEncodedCert ) { if ( derEncodedCert == null || derEncodedCert . length == 0 ) { return null ; } try { final CertificateFactory cf = CertificateFactory . getInstance ( "X.509" ) ; final Certificate cert = cf . generateCertificate ( new ByteArrayInputStream ( derEncodedCert ) ) ; if ( ! ( cert instanceof X509Certificate ) ) { return null ; } return ( X509Certificate ) cert ; } catch ( CertificateException e ) { return null ; } }
Parses a DER-encoded X.509 certificate.
Parses a DER - encoded X . 509 certificate .