public void saveKeystore(OutputStream outputStream) throws EsHadoopSecurityException, IOException { try { keyStore.store(outputStream, protection.getPassword()); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } }
prompt.println("ERRORCould not load keystore file: " + ehse.getMessage()); return 8; } catch (FileNotFoundException fnfe) {
prompt.println("ERRORCould not load keystore file: " + ehse.getMessage()); return 8; } catch (FileNotFoundException fnfe) {
private KeystoreWrapper(InputStream inputStream, String type, String password) throws EsHadoopSecurityException, IOException { Assert.notNull(password, "Password should not be null"); try { char[] pwd = password.toCharArray(); protection = new KeyStore.PasswordProtection(pwd); keyStore = KeyStore.getInstance(type); keyStore.load(inputStream, pwd); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } }
prompt.println("ERRORCould not load keystore file: " + ehse.getMessage()); return 8; } catch (FileNotFoundException fnfe) {
public void removeSecureSetting(String alias) throws EsHadoopSecurityException { try { keyStore.deleteEntry(alias); } catch (KeyStoreException e) { throw new EsHadoopSecurityException(String.format("Could not delete secret key (alias : [%s]) from keystore", alias), e); } }
prompt.println("ERRORCould not load keystore file: " + ehse.getMessage()); return 8; } catch (FileNotFoundException fnfe) {
public boolean containsEntry(String alias) throws EsHadoopSecurityException { try { return keyStore.containsAlias(alias); } catch (KeyStoreException e) { throw new EsHadoopSecurityException(String.format("Could not read existence of alias [%s]", alias), e); } }
public List<String> listEntries() throws EsHadoopSecurityException { try { List<String> entries = new ArrayList<String>(keyStore.size()); Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); entries.add(alias); } return entries; } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not read aliases from keystore", e); } }
public String getSecureSetting(String alias) throws EsHadoopSecurityException { try { if (!keyStore.containsAlias(alias)) { return null; } KeyStore.Entry entry = keyStore.getEntry(alias, protection); KeyStore.SecretKeyEntry secretKeyEntry = ((KeyStore.SecretKeyEntry) entry); return new String(secretKeyEntry.getSecretKey().getEncoded()); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException(String.format("Could not read alias [%s] from keystore", alias), e); } catch (UnrecoverableEntryException e) { throw new EsHadoopSecurityException(String.format("Could not read alias [%s] from keystore", alias), e); } catch (KeyStoreException e) { throw new EsHadoopSecurityException(String.format("Could not read alias [%s] from keystore", alias), e); } }
public void setSecureSetting(String alias, String key) throws EsHadoopSecurityException { SecretKey spec = new SecretKeySpec(key.getBytes(), AES); KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(spec); try { keyStore.setEntry(alias, entry, protection); } catch (KeyStoreException e) { throw new EsHadoopSecurityException(String.format("Could not store secret key (alias : [%s]) in keystore", alias), e); } }
public void saveKeystore(OutputStream outputStream) throws EsHadoopSecurityException, IOException { try { keyStore.store(outputStream, protection.getPassword()); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } }
public void saveKeystore(OutputStream outputStream) throws EsHadoopSecurityException, IOException { try { keyStore.store(outputStream, protection.getPassword()); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } }
public void saveKeystore(OutputStream outputStream) throws EsHadoopSecurityException, IOException { try { keyStore.store(outputStream, protection.getPassword()); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not persist keystore", e); } }
private KeystoreWrapper(InputStream inputStream, String type, String password) throws EsHadoopSecurityException, IOException { Assert.notNull(password, "Password should not be null"); try { char[] pwd = password.toCharArray(); protection = new KeyStore.PasswordProtection(pwd); keyStore = KeyStore.getInstance(type); keyStore.load(inputStream, pwd); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } }
private KeystoreWrapper(InputStream inputStream, String type, String password) throws EsHadoopSecurityException, IOException { Assert.notNull(password, "Password should not be null"); try { char[] pwd = password.toCharArray(); protection = new KeyStore.PasswordProtection(pwd); keyStore = KeyStore.getInstance(type); keyStore.load(inputStream, pwd); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } }
private KeystoreWrapper(InputStream inputStream, String type, String password) throws EsHadoopSecurityException, IOException { Assert.notNull(password, "Password should not be null"); try { char[] pwd = password.toCharArray(); protection = new KeyStore.PasswordProtection(pwd); keyStore = KeyStore.getInstance(type); keyStore.load(inputStream, pwd); } catch (CertificateException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (NoSuchAlgorithmException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not create keystore", e); } }
public boolean containsEntry(String alias) throws EsHadoopSecurityException { try { return keyStore.containsAlias(alias); } catch (KeyStoreException e) { throw new EsHadoopSecurityException(String.format("Could not read existence of alias [%s]", alias), e); } }
public List<String> listEntries() throws EsHadoopSecurityException { try { List<String> entries = new ArrayList<String>(keyStore.size()); Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); entries.add(alias); } return entries; } catch (KeyStoreException e) { throw new EsHadoopSecurityException("Could not read aliases from keystore", e); } }
public void removeSecureSetting(String alias) throws EsHadoopSecurityException { try { keyStore.deleteEntry(alias); } catch (KeyStoreException e) { throw new EsHadoopSecurityException(String.format("Could not delete secret key (alias : [%s]) from keystore", alias), e); } }