BootstrappedKeyStoreProtectionManager implements KeyStoreProtectionManager { @Override public Map<String, Key> getAllKeys() throws CryptoException { final Map<String, Key> keys = new HashMap<String, Key>(); keys.put("PrivKeyProtKey", getPrivateKeyProtectionKey()); keys.put("KeyStoreProtKey", getKeyStoreProtectionKey()); return keys; } BootstrappedKeyStoreProtectionManager();  BootstrappedKeyStoreProtectionManager(String keyStoreProtectionKey, String privateKeyProtectionKey); void setKeyStoreProtectionKey(byte[] keyStoreProtectionKey); void setKeyStoreProtectionKey(String keyStoreProtectionKey); void setPrivateKeyProtectionKey(byte[] privateKeyProtectionKey); void setPrivateKeyProtectionKey(String privateKeyProtectionKey); @Override Key getPrivateKeyProtectionKey(); @Override Key getKeyStoreProtectionKey(); @Override Map<String, Key> getAllKeys(); @Override Key getKey(String keyName);  }
@Test public void testGetAllKeys() throws Exception { BootstrappedKeyStoreProtectionManager mgr = new BootstrappedKeyStoreProtectionManager(); mgr.setKeyStoreProtectionKey("1234"); mgr.setPrivateKeyProtectionKey("5678"); final Map<String, Key> keys = mgr.getAllKeys(); assertEquals(2, keys.size()); Iterator<Entry<String, Key>> entryIter = keys.entrySet().iterator(); Key key = entryIter.next().getValue(); assertTrue(Arrays.equals("5678".getBytes(), key.getEncoded())); key = entryIter.next().getValue(); assertTrue(Arrays.equals("1234".getBytes(), key.getEncoded())); }