@Test public void changePassword() throws KeyStoreException { ECKeyStore ks = new ECKeyStore(); PrivateKey k1 = PrivateKey.fresh(NetworkType.TESTNET); String alias1 = ks.addKey(k1); ks.changePassword("test".toCharArray()); PrivateKey k2 = ks.getKey(ECKeyStore.getUniqueID(k1)); assertTrue(ks.containsKey(alias1)); assertArrayEquals(k1.getBytes(), k2.getBytes()); assertEquals(k1.getNetworkType(), k2.getNetworkType()); }
public void changePassword(char[] password) throws KeyStoreException { try { for (String alias : Collections.list(ks.aliases())) { Entry entry = ks.getEntry(alias, new PasswordProtection(this.password)); ks.setEntry(alias, entry, new PasswordProtection(password)); } Arrays.fill(this.password, '0'); this.password = Arrays.copyOf(password, password.length); } catch (NoSuchAlgorithmException | UnrecoverableEntryException e) { throw new KeyStoreException(e); } }
ECKeyStore { public void changePassword(char[] password) throws KeyStoreException { try { for (String alias : Collections.list(ks.aliases())) { Entry entry = ks.getEntry(alias, new PasswordProtection(this.password)); ks.setEntry(alias, entry, new PasswordProtection(password)); } Arrays.fill(this.password, '0'); this.password = Arrays.copyOf(password, password.length); } catch (NoSuchAlgorithmException | UnrecoverableEntryException e) { throw new KeyStoreException(e); } } }
ECKeyStore { public void changePassword(char[] password) throws KeyStoreException { try { for (String alias : Collections.list(ks.aliases())) { Entry entry = ks.getEntry(alias, new PasswordProtection(this.password)); ks.setEntry(alias, entry, new PasswordProtection(password)); } Arrays.fill(this.password, '0'); this.password = Arrays.copyOf(password, password.length); } catch (NoSuchAlgorithmException | UnrecoverableEntryException e) { throw new KeyStoreException(e); } } ECKeyStore();  ECKeyStore(char[] password);  ECKeyStore(InputStream input, char[] password); }
ECKeyStore { public void changePassword(char[] password) throws KeyStoreException { try { for (String alias : Collections.list(ks.aliases())) { Entry entry = ks.getEntry(alias, new PasswordProtection(this.password)); ks.setEntry(alias, entry, new PasswordProtection(password)); } Arrays.fill(this.password, '0'); this.password = Arrays.copyOf(password, password.length); } catch (NoSuchAlgorithmException | UnrecoverableEntryException e) { throw new KeyStoreException(e); } } ECKeyStore();  ECKeyStore(char[] password);  ECKeyStore(InputStream input, char[] password); static String getUniqueID(PrivateKey key); String addKey(PrivateKey key); PrivateKey getKey(String keyID); boolean containsKey(String keyID); void store(File ksFile); void changePassword(char[] password); }
ECKeyStore { public void changePassword(char[] password) throws KeyStoreException { try { for (String alias : Collections.list(ks.aliases())) { Entry entry = ks.getEntry(alias, new PasswordProtection(this.password)); ks.setEntry(alias, entry, new PasswordProtection(password)); } Arrays.fill(this.password, '0'); this.password = Arrays.copyOf(password, password.length); } catch (NoSuchAlgorithmException | UnrecoverableEntryException e) { throw new KeyStoreException(e); } } ECKeyStore();  ECKeyStore(char[] password);  ECKeyStore(InputStream input, char[] password); static String getUniqueID(PrivateKey key); String addKey(PrivateKey key); PrivateKey getKey(String keyID); boolean containsKey(String keyID); void store(File ksFile); void changePassword(char[] password);  }