@Test public void testParsePrivateKey() throws Exception { try ( final InputStream stream = getClass().getResourceAsStream( "/privatekey.pem" ) ) { final PrivateKey result = CertificateManager.parsePrivateKey( stream, "" ); assertNotNull( result ); } }
public static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase) throws IOException { if (pemRepresentation == null || pemRepresentation.trim().isEmpty()) { throw new IllegalArgumentException("Argument 'pemRepresentation' cannot be null or an empty String."); } ByteArrayInputStream input = new ByteArrayInputStream(pemRepresentation.getBytes(StandardCharsets.UTF_8)); return parsePrivateKey(input, passPhrase); }
CertificateManager { public static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase) throws IOException { if (pemRepresentation == null || pemRepresentation.trim().isEmpty()) { throw new IllegalArgumentException("Argument 'pemRepresentation' cannot be null or an empty String."); } ByteArrayInputStream input = new ByteArrayInputStream(pemRepresentation.getBytes(StandardCharsets.UTF_8)); return parsePrivateKey(input, passPhrase); } }
CertificateManager { public static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase) throws IOException { if (pemRepresentation == null || pemRepresentation.trim().isEmpty()) { throw new IllegalArgumentException("Argument 'pemRepresentation' cannot be null or an empty String."); } ByteArrayInputStream input = new ByteArrayInputStream(pemRepresentation.getBytes(StandardCharsets.UTF_8)); return parsePrivateKey(input, passPhrase); }  }
CertificateManager { public static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase) throws IOException { if (pemRepresentation == null || pemRepresentation.trim().isEmpty()) { throw new IllegalArgumentException("Argument 'pemRepresentation' cannot be null or an empty String."); } ByteArrayInputStream input = new ByteArrayInputStream(pemRepresentation.getBytes(StandardCharsets.UTF_8)); return parsePrivateKey(input, passPhrase); }  static List<String> getClientIdentities(X509Certificate x509Certificate); static List<String> getServerIdentities(X509Certificate x509Certificate); static boolean isSelfSignedCertificate(X509Certificate certificate); static boolean isSigningRequestPending(X509Certificate certificate); static String createSigningRequest(X509Certificate cert, PrivateKey privKey); static String toPemRepresentation( Object object ); static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase); static PrivateKey parsePrivateKey(InputStream pemRepresentation, String passPhrase); static Collection<X509Certificate> parseCertificates(String pemRepresentation); @SuppressWarnings("unchecked") static Collection<X509Certificate> parseCertificates(InputStream pemRepresentation); static void addListener(CertificateEventListener listener); static void removeListener(CertificateEventListener listener); static void fireCertificateStoreChanged( CertificateStore store ); @Deprecated static List<X509Certificate> order( Collection<X509Certificate> certificates ); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, String issuerCommonName,
                                                                        String subjectCommonName, String domain,
                                                                        String signAlgoritm); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, String issuerCommonName,
                                                                        String subjectCommonName, String domain,
                                                                        String signAlgoritm, Set<String> sanDnsNames); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, X500NameBuilder issuerBuilder,
            X500NameBuilder subjectBuilder, String domain, String signAlgoritm ); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, X500NameBuilder issuerBuilder,
            X500NameBuilder subjectBuilder, String domain, String signAlgoritm, Set<String> sanDnsNames ); static Set<String> determineSubjectAlternateNameDnsNameValues(); }
CertificateManager { public static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase) throws IOException { if (pemRepresentation == null || pemRepresentation.trim().isEmpty()) { throw new IllegalArgumentException("Argument 'pemRepresentation' cannot be null or an empty String."); } ByteArrayInputStream input = new ByteArrayInputStream(pemRepresentation.getBytes(StandardCharsets.UTF_8)); return parsePrivateKey(input, passPhrase); }  static List<String> getClientIdentities(X509Certificate x509Certificate); static List<String> getServerIdentities(X509Certificate x509Certificate); static boolean isSelfSignedCertificate(X509Certificate certificate); static boolean isSigningRequestPending(X509Certificate certificate); static String createSigningRequest(X509Certificate cert, PrivateKey privKey); static String toPemRepresentation( Object object ); static PrivateKey parsePrivateKey(String pemRepresentation, String passPhrase); static PrivateKey parsePrivateKey(InputStream pemRepresentation, String passPhrase); static Collection<X509Certificate> parseCertificates(String pemRepresentation); @SuppressWarnings("unchecked") static Collection<X509Certificate> parseCertificates(InputStream pemRepresentation); static void addListener(CertificateEventListener listener); static void removeListener(CertificateEventListener listener); static void fireCertificateStoreChanged( CertificateStore store ); @Deprecated static List<X509Certificate> order( Collection<X509Certificate> certificates ); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, String issuerCommonName,
                                                                        String subjectCommonName, String domain,
                                                                        String signAlgoritm); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, String issuerCommonName,
                                                                        String subjectCommonName, String domain,
                                                                        String signAlgoritm, Set<String> sanDnsNames); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, X500NameBuilder issuerBuilder,
            X500NameBuilder subjectBuilder, String domain, String signAlgoritm ); static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, X500NameBuilder issuerBuilder,
            X500NameBuilder subjectBuilder, String domain, String signAlgoritm, Set<String> sanDnsNames ); static Set<String> determineSubjectAlternateNameDnsNameValues();  }