@Test public void testReadCertificate() throws CertificateException, IOException { X509Certificate[] certificate = CertUtils.readCertificateChain("src/test/resources/internal.crt"); assertNotNull(certificate); assertEquals(certificate[0].getSubjectDN().getName(), "CN=ubuntu-xroad-securityserver-dev"); }
public static X509Certificate[] readCertificateChain(String filename) throws CertificateException, IOException { CertificateFactory fact = CertificateFactory.getInstance("X.509"); try (FileInputStream is = new FileInputStream(filename)) { final Collection<? extends Certificate> certs = fact.generateCertificates(is); return certs.toArray(new X509Certificate[0]); } }
CertUtils { public static X509Certificate[] readCertificateChain(String filename) throws CertificateException, IOException { CertificateFactory fact = CertificateFactory.getInstance("X.509"); try (FileInputStream is = new FileInputStream(filename)) { final Collection<? extends Certificate> certs = fact.generateCertificates(is); return certs.toArray(new X509Certificate[0]); } } }
CertUtils { public static X509Certificate[] readCertificateChain(String filename) throws CertificateException, IOException { CertificateFactory fact = CertificateFactory.getInstance("X.509"); try (FileInputStream is = new FileInputStream(filename)) { final Collection<? extends Certificate> certs = fact.generateCertificates(is); return certs.toArray(new X509Certificate[0]); } } private  CertUtils(); }
CertUtils { public static X509Certificate[] readCertificateChain(String filename) throws CertificateException, IOException { CertificateFactory fact = CertificateFactory.getInstance("X.509"); try (FileInputStream is = new FileInputStream(filename)) { final Collection<? extends Certificate> certs = fact.generateCertificates(is); return certs.toArray(new X509Certificate[0]); } } private  CertUtils(); static String getSubjectCommonName(X509Certificate cert); static String getSubjectSerialNumber(X509Certificate cert); static ClientId getSubjectClientId(X509Certificate cert); static boolean isAuthCert(X509Certificate cert); static boolean isSigningCert(X509Certificate cert); static boolean isValid(X509Certificate cert); static boolean isSelfSigned(X509Certificate cert); static String getOcspResponderUriFromCert(X509Certificate subject); static String[] getCertHashes(List<X509Certificate> certs); static String getRDNValue(X500Name name, ASN1ObjectIdentifier id); static byte[] generateCertRequest(PrivateKey privateKey, PublicKey publicKey, String
            principal); static KeyPair readKeyPairFromPemFile(String filename); static void writePemToFile(byte[] certBytes, String filename); static X509Certificate[] readCertificateChain(String filename); static void createPkcs12(String filenameKey, String filenamePem, String filenameP12); static String identify(X509Certificate certificate); }
CertUtils { public static X509Certificate[] readCertificateChain(String filename) throws CertificateException, IOException { CertificateFactory fact = CertificateFactory.getInstance("X.509"); try (FileInputStream is = new FileInputStream(filename)) { final Collection<? extends Certificate> certs = fact.generateCertificates(is); return certs.toArray(new X509Certificate[0]); } } private  CertUtils(); static String getSubjectCommonName(X509Certificate cert); static String getSubjectSerialNumber(X509Certificate cert); static ClientId getSubjectClientId(X509Certificate cert); static boolean isAuthCert(X509Certificate cert); static boolean isSigningCert(X509Certificate cert); static boolean isValid(X509Certificate cert); static boolean isSelfSigned(X509Certificate cert); static String getOcspResponderUriFromCert(X509Certificate subject); static String[] getCertHashes(List<X509Certificate> certs); static String getRDNValue(X500Name name, ASN1ObjectIdentifier id); static byte[] generateCertRequest(PrivateKey privateKey, PublicKey publicKey, String
            principal); static KeyPair readKeyPairFromPemFile(String filename); static void writePemToFile(byte[] certBytes, String filename); static X509Certificate[] readCertificateChain(String filename); static void createPkcs12(String filenameKey, String filenamePem, String filenameP12); static String identify(X509Certificate certificate);  }