CertificateParser { public static X509Certificate parsePem(String pemEncodedCert) throws CertificateException { return parseDer(pemEncodedCert.replaceAll("-----BEGIN CERTIFICATE-----", "").replaceAll("-----END CERTIFICATE-----", "").replaceAll("\n", "")); }  static X509Certificate parsePem(String pemEncodedCert); static X509Certificate parseDer(String base64DerEncodedCert); static X509Certificate parseDer(byte[] derEncodedCert); static X509Certificate parseDer(InputStream is);  }
@Test public void parsePemDoesNotReturnNull() throws CertificateException { assertNotNull(CertificateParser.parsePem(PEM_ATTESTATION_CERT)); }