CertUtil { public static X509Certificate parseCert(String cert) throws CertificateException { return parseCert(Base64.getDecoder().decode(Objects.requireNonNull(cert))); } private  CertUtil(); static X509Certificate getServerRoot(); static X509Certificate getPluginRoot(); static X509Certificate getDefaultCert(); static PrivateKey getDefaultKey(); static boolean checkValidity(X509Certificate cert); static boolean checkHostname(X509Certificate cert, String hostname); static X509Certificate parseCert(String cert); static X509Certificate parseCert(File cert); static X509Certificate parseCert(byte[] cert); static PrivateKey parseKey(byte[] key); static String getInfoString(String cert); static String getInfoString(X509Certificate cert); static String getInfoHtml(X509Certificate cert);  }
@Test @DisplayName("Parse a base-64 encoded certificate") void parseString_1() throws CertificateException { X509Certificate cert = CertUtil.parseCert(testCert); assertEquals(new Date(1495861281000L), cert.getNotBefore()); assertEquals(new Date(1527397281000L), cert.getNotAfter()); }
@Test @DisplayName("Parse a certificate") void parseBytes_1() throws CertificateException { X509Certificate cert = CertUtil.parseCert(Base64.getDecoder().decode(testCert)); assertEquals(new Date(1495861281000L), cert.getNotBefore()); assertEquals(new Date(1527397281000L), cert.getNotAfter()); }