java/src/main/java/com/genexus/security/web/jose/jwt/pem/X509CertUtils.java
/**
     * Parses a PEM-encoded X.509 certificate.
     */
Parses a PEM-encoded X.509 certificate.
Parses a PEM - encoded X . 509 certificate .
public static X509Certificate parse(final String pemEncodedCert) {
        if (pemEncodedCert == null || pemEncodedCert.isEmpty()) {
            return null;
        }
        final int markerStart = pemEncodedCert.indexOf(PEM_BEGIN_MARKER);
        if (markerStart < 0) {
            return null;
        }
        String buf = pemEncodedCert.substring(markerStart + PEM_BEGIN_MARKER.length());
        final int markerEnd = buf.indexOf(PEM_END_MARKER);
        if (markerEnd < 0) {
            return null;
        }
        buf = buf.substring(0, markerEnd);
        buf = buf.replaceAll("\\s", "");
        return parse(new Base64(true).decodeBase64(buf));
    }
public static X509Certificate parse ( final String pemEncodedCert ) { if ( pemEncodedCert == null || pemEncodedCert . isEmpty ( ) ) { return null ; } final int markerStart = pemEncodedCert . indexOf ( PEM_BEGIN_MARKER ) ; if ( markerStart < 0 ) { return null ; } String buf = pemEncodedCert . substring ( markerStart + PEM_BEGIN_MARKER . length ( ) ) ; final int markerEnd = buf . indexOf ( PEM_END_MARKER ) ; if ( markerEnd < 0 ) { return null ; } buf = buf . substring ( 0 , markerEnd ) ; buf = buf . replaceAll ( "\\s" , "" ) ; return parse ( new Base64 ( true ) . decodeBase64 ( buf ) ) ; }
Parses a PEM-encoded X.509 certificate.
Parses a PEM - encoded X . 509 certificate .