@Test(expected = IOException.class) public void testLoadKeyStoreWithWrongFilePath() throws Exception { String path = x509TestContext.getKeyStoreFile(KeyStoreFileType.PEM) .getAbsolutePath(); new PEMFileLoader.Builder() .setKeyStorePath(path + ".does_not_exist") .setKeyStorePassword(x509TestContext.getKeyStorePassword()) .build() .loadKeyStore(); }
@Override public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { Optional<String> passwordOption; if (keyStorePassword == null || keyStorePassword.length() == 0) { passwordOption = Optional.empty(); } else { passwordOption = Optional.of(keyStorePassword); } File file = new File(keyStorePath); return PemReader.loadKeyStore(file, file, passwordOption); }
PEMFileLoader extends FileKeyStoreLoader { @Override public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { Optional<String> passwordOption; if (keyStorePassword == null || keyStorePassword.length() == 0) { passwordOption = Optional.empty(); } else { passwordOption = Optional.of(keyStorePassword); } File file = new File(keyStorePath); return PemReader.loadKeyStore(file, file, passwordOption); } }
PEMFileLoader extends FileKeyStoreLoader { @Override public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { Optional<String> passwordOption; if (keyStorePassword == null || keyStorePassword.length() == 0) { passwordOption = Optional.empty(); } else { passwordOption = Optional.of(keyStorePassword); } File file = new File(keyStorePath); return PemReader.loadKeyStore(file, file, passwordOption); } private  PEMFileLoader(String keyStorePath,
                          String trustStorePath,
                          String keyStorePassword,
                          String trustStorePassword); }
PEMFileLoader extends FileKeyStoreLoader { @Override public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { Optional<String> passwordOption; if (keyStorePassword == null || keyStorePassword.length() == 0) { passwordOption = Optional.empty(); } else { passwordOption = Optional.of(keyStorePassword); } File file = new File(keyStorePath); return PemReader.loadKeyStore(file, file, passwordOption); } private  PEMFileLoader(String keyStorePath,
                          String trustStorePath,
                          String keyStorePassword,
                          String trustStorePassword); @Override KeyStore loadKeyStore(); @Override KeyStore loadTrustStore(); }
PEMFileLoader extends FileKeyStoreLoader { @Override public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { Optional<String> passwordOption; if (keyStorePassword == null || keyStorePassword.length() == 0) { passwordOption = Optional.empty(); } else { passwordOption = Optional.of(keyStorePassword); } File file = new File(keyStorePath); return PemReader.loadKeyStore(file, file, passwordOption); } private  PEMFileLoader(String keyStorePath,
                          String trustStorePath,
                          String keyStorePassword,
                          String trustStorePassword); @Override KeyStore loadKeyStore(); @Override KeyStore loadTrustStore();  }