@Test public void testSingleKMSFactory() throws Exception { Properties props = getKMSProperties("", DEFAULT_KEY_SIZE_CHARS); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); try { new SingleKeyManagementServiceFactory(verifiableProperties, CLUSTER_NAME, REGISTRY).getKeyManagementService(); Assert.fail("SingleKeyManagementFactory instantiation should have failed as single default key is null "); } catch (IllegalArgumentException e) { } String key = TestUtils.getRandomKey(DEFAULT_KEY_SIZE_CHARS); props = getKMSProperties(key, DEFAULT_RANDOM_KEY_SIZE_BITS); verifiableProperties = new VerifiableProperties((props)); KeyManagementService<SecretKeySpec> kms = new SingleKeyManagementServiceFactory(verifiableProperties, CLUSTER_NAME, REGISTRY).getKeyManagementService(); }
@Override public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); }
SingleKeyManagementService implements KeyManagementService<SecretKeySpec> { @Override public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); } }
SingleKeyManagementService implements KeyManagementService<SecretKeySpec> { @Override public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); } SingleKeyManagementService(KMSConfig config, String defaultContainerKey); }
SingleKeyManagementService implements KeyManagementService<SecretKeySpec> { @Override public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); } SingleKeyManagementService(KMSConfig config, String defaultContainerKey); @Override void register(short accountId, short containerId); @Override void register(String context); @Override SecretKeySpec getKey(short accountId, short containerId); @Override SecretKeySpec getKey(String context); @Override SecretKeySpec getRandomKey(); @Override void close(); }
SingleKeyManagementService implements KeyManagementService<SecretKeySpec> { @Override public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); } SingleKeyManagementService(KMSConfig config, String defaultContainerKey); @Override void register(short accountId, short containerId); @Override void register(String context); @Override SecretKeySpec getKey(short accountId, short containerId); @Override SecretKeySpec getKey(String context); @Override SecretKeySpec getRandomKey(); @Override void close();  }