@Test(expected = KeyStoreException.class) public void testLoadPrivateKeyFromTrustStoreWithPassword() throws IOException, GeneralSecurityException { PemReader.loadPrivateKey( x509TestContext.getTrustStoreFile(KeyStoreFileType.PEM), Optional.of("foobar")); }
public static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException { String privateKey = new String(Files.readAllBytes(privateKeyFile.toPath()), US_ASCII); return loadPrivateKey(privateKey, keyPassword); }
PemReader { public static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException { String privateKey = new String(Files.readAllBytes(privateKeyFile.toPath()), US_ASCII); return loadPrivateKey(privateKey, keyPassword); } }
PemReader { public static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException { String privateKey = new String(Files.readAllBytes(privateKeyFile.toPath()), US_ASCII); return loadPrivateKey(privateKey, keyPassword); } private  PemReader(); }
PemReader { public static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException { String privateKey = new String(Files.readAllBytes(privateKeyFile.toPath()), US_ASCII); return loadPrivateKey(privateKey, keyPassword); } private  PemReader(); static KeyStore loadTrustStore(File certificateChainFile); static KeyStore loadKeyStore(File certificateChainFile, File privateKeyFile, Optional<String> keyPassword); static List<X509Certificate> readCertificateChain(File certificateChainFile); static List<X509Certificate> readCertificateChain(String certificateChain); static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword); static PrivateKey loadPrivateKey(String privateKey, Optional<String> keyPassword); static PublicKey loadPublicKey(File publicKeyFile); static PublicKey loadPublicKey(String publicKey); }
PemReader { public static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException { String privateKey = new String(Files.readAllBytes(privateKeyFile.toPath()), US_ASCII); return loadPrivateKey(privateKey, keyPassword); } private  PemReader(); static KeyStore loadTrustStore(File certificateChainFile); static KeyStore loadKeyStore(File certificateChainFile, File privateKeyFile, Optional<String> keyPassword); static List<X509Certificate> readCertificateChain(File certificateChainFile); static List<X509Certificate> readCertificateChain(String certificateChain); static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword); static PrivateKey loadPrivateKey(String privateKey, Optional<String> keyPassword); static PublicKey loadPublicKey(File publicKeyFile); static PublicKey loadPublicKey(String publicKey);  }