use of com.hazelcast.config.JavaKeyStoreSecureStoreConfig in project hazelcast by hazelcast.
the class TestPersistenceEncryptionKeyStoreApplicationContext method testPersistence.
@Test
public void testPersistence() {
File dir = new File("/mnt/persistence/");
File hotBackupDir = new File("/mnt/persistence-backup/");
PersistenceConfig persistenceConfig = config.getPersistenceConfig();
assertFalse(persistenceConfig.isEnabled());
assertEquals(dir.getAbsolutePath(), persistenceConfig.getBaseDir().getAbsolutePath());
assertEquals(hotBackupDir.getAbsolutePath(), persistenceConfig.getBackupDir().getAbsolutePath());
assertEquals(1111, persistenceConfig.getValidationTimeoutSeconds());
assertEquals(2222, persistenceConfig.getDataLoadTimeoutSeconds());
assertEquals(PARTIAL_RECOVERY_MOST_COMPLETE, persistenceConfig.getClusterDataRecoveryPolicy());
assertFalse(persistenceConfig.isAutoRemoveStaleData());
EncryptionAtRestConfig encryptionAtRestConfig = persistenceConfig.getEncryptionAtRestConfig();
assertNotNull(encryptionAtRestConfig);
assertTrue(encryptionAtRestConfig.isEnabled());
assertEquals("AES/CBC/PKCS5Padding", encryptionAtRestConfig.getAlgorithm());
assertEquals("sugar", encryptionAtRestConfig.getSalt());
assertEquals(16, encryptionAtRestConfig.getKeySize());
assertTrue(encryptionAtRestConfig.getSecureStoreConfig() instanceof JavaKeyStoreSecureStoreConfig);
JavaKeyStoreSecureStoreConfig keyStoreConfig = (JavaKeyStoreSecureStoreConfig) encryptionAtRestConfig.getSecureStoreConfig();
assertEquals(new File("/mnt/hot-restart/keystore.p12").getAbsolutePath(), keyStoreConfig.getPath().getAbsolutePath());
assertEquals("PKCS12", keyStoreConfig.getType());
assertEquals("password", keyStoreConfig.getPassword());
assertEquals(60, keyStoreConfig.getPollingInterval());
}
use of com.hazelcast.config.JavaKeyStoreSecureStoreConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method handleJavaKeyStore.
private SecureStoreConfig handleJavaKeyStore(Node keyStoreRoot) {
File path = null;
String password = null;
String type = null;
String currentKeyAlias = null;
int pollingInterval = JavaKeyStoreSecureStoreConfig.DEFAULT_POLLING_INTERVAL;
for (Node n : childElements(keyStoreRoot)) {
String name = cleanNodeName(n);
if (matches("path", name)) {
path = new File(getTextContent(n)).getAbsoluteFile();
} else if (matches("type", name)) {
type = getTextContent(n);
} else if (matches("password", name)) {
password = getTextContent(n);
} else if (matches("current-key-alias", name)) {
currentKeyAlias = getTextContent(n);
} else if (matches("polling-interval", name)) {
pollingInterval = parseInt(getTextContent(n));
}
}
JavaKeyStoreSecureStoreConfig keyStoreSecureStoreConfig = new JavaKeyStoreSecureStoreConfig(path).setPassword(password).setPollingInterval(pollingInterval).setCurrentKeyAlias(currentKeyAlias);
if (type != null) {
keyStoreSecureStoreConfig.setType(type);
}
return keyStoreSecureStoreConfig;
}
Aggregations