List of usage examples for javax.crypto.spec PBEKeySpec getPassword
public final char[] getPassword()
From source file:org.opennms.features.scv.impl.JCEKSSecureCredentialsVault.java
@Override public Credentials getCredentials(String alias) { try {//from w w w. j a v a2 s. com KeyStore.PasswordProtection keyStorePP = new KeyStore.PasswordProtection(m_password); SecretKeyFactory factory = SecretKeyFactory.getInstance("PBE"); KeyStore.SecretKeyEntry ske = (KeyStore.SecretKeyEntry) m_keystore.getEntry(alias, keyStorePP); if (ske == null) { return null; } PBEKeySpec keySpec = (PBEKeySpec) factory.getKeySpec(ske.getSecretKey(), PBEKeySpec.class); return fromBase64EncodedByteArray(new String(keySpec.getPassword()).getBytes()); } catch (KeyStoreException | InvalidKeySpecException | NoSuchAlgorithmException | IOException | ClassNotFoundException | UnrecoverableEntryException e) { throw Throwables.propagate(e); } }