use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi in project ignite by apache.
the class AbstractSnapshotSelfTest method startGrid.
/**
* {@inheritDoc}
*/
@Override
protected Ignite startGrid(String igniteInstanceName, IgniteConfiguration cfg, GridSpringResourceContext ctx) throws Exception {
if (encryption && persistence) {
KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();
encSpi.setKeyStorePath(AbstractEncryptionTest.KEYSTORE_PATH);
encSpi.setKeyStorePassword(AbstractEncryptionTest.KEYSTORE_PASSWORD.toCharArray());
if (masterKeyName != null)
encSpi.setMasterKeyName(masterKeyName);
cfg.setEncryptionSpi(encSpi);
if (cfg.getCacheConfiguration() != null) {
for (CacheConfiguration<?, ?> cacheCfg : cfg.getCacheConfiguration()) cacheCfg.setEncryptionEnabled(true);
}
}
return super.startGrid(igniteInstanceName, cfg, ctx);
}
use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi in project ignite by apache.
the class KeystoreEncryptionSpiSelfTest method spi.
/**
*/
@NotNull
private EncryptionSpi spi() throws Exception {
KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();
encSpi.setKeyStorePath(KEYSTORE_PATH);
encSpi.setKeyStorePassword(KEYSTORE_PASSWORD.toCharArray());
GridTestUtils.invoke(encSpi, "onBeforeStart");
encSpi.spiStart("default");
return encSpi;
}
use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi in project ignite by apache.
the class TDE method configuration.
@Test
void configuration() {
// tag::config[]
IgniteConfiguration cfg = new IgniteConfiguration();
KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();
encSpi.setKeyStorePath("/home/user/ignite-keystore.jks");
encSpi.setKeyStorePassword("secret".toCharArray());
cfg.setEncryptionSpi(encSpi);
// end::config[]
Ignite ignite = Ignition.start(cfg);
// tag::cache[]
CacheConfiguration<Long, String> ccfg = new CacheConfiguration<Long, String>("encrypted-cache");
ccfg.setEncryptionEnabled(true);
ignite.createCache(ccfg);
// end::cache[]
// tag::master-key-rotation[]
// Gets the current master key name.
String name = ignite.encryption().getMasterKeyName();
// Starts master key change process.
IgniteFuture<Void> future = ignite.encryption().changeMasterKey("newMasterKeyName");
// end::master-key-rotation[]
// tag::cache-group-key-rotation[]
// Starts cache group encryption key change process.
// This future will be completed when the new encryption key is set for writing on
// all nodes in the cluster and re-encryption of existing cache data is initiated.
IgniteFuture<Void> fut = ignite.encryption().changeCacheGroupKey(Collections.singleton("encrypted-cache"));
// end::cache-group-key-rotation[]
ignite.close();
}
use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi in project ignite by apache.
the class GridCommandHandlerAbstractTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (atomicConfiguration != null)
cfg.setAtomicConfiguration(atomicConfiguration);
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
cfg.setConnectorConfiguration(new ConnectorConfiguration().setSslEnabled(sslEnabled()));
if (sslEnabled())
cfg.setSslContextFactory(GridTestUtils.sslFactory());
DataStorageConfiguration dsCfg = new DataStorageConfiguration().setWalMode(WALMode.LOG_ONLY).setCheckpointFrequency(checkpointFreq).setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50L * 1024 * 1024).setPersistenceEnabled(persistent));
if (dataRegionConfiguration != null)
dsCfg.setDataRegionConfigurations(dataRegionConfiguration);
cfg.setDataStorageConfiguration(dsCfg);
cfg.setConsistentId(igniteInstanceName);
cfg.setClientMode(igniteInstanceName.startsWith(CLIENT_NODE_NAME_PREFIX));
cfg.setDaemon(igniteInstanceName.startsWith(DAEMON_NODE_NAME_PREFIX));
// Extend if necessary.
cfg.setIncludeEventTypes(EVT_CONSISTENCY_VIOLATION);
if (encryptionEnabled) {
KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();
encSpi.setKeyStorePath(KEYSTORE_PATH);
encSpi.setKeyStorePassword(KEYSTORE_PASSWORD.toCharArray());
cfg.setEncryptionSpi(encSpi);
EncryptionConfiguration encCfg = new EncryptionConfiguration();
encCfg.setReencryptionRateLimit(reencryptSpeed);
encCfg.setReencryptionBatchSize(reencryptBatchSize);
dsCfg.setEncryptionConfiguration(encCfg);
}
return cfg;
}
use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi in project ignite by apache.
the class PlatformConfigurationUtils method writeEncryptionConfiguration.
/**
* Writes encryption configuration.
*
* @param w Writer.
* @param enc Encryption Spi.
*/
private static void writeEncryptionConfiguration(BinaryRawWriter w, EncryptionSpi enc) {
if (enc instanceof NoopEncryptionSpi) {
w.writeBoolean(false);
return;
}
KeystoreEncryptionSpi keystoreEnc = (KeystoreEncryptionSpi) enc;
w.writeBoolean(true);
w.writeString(keystoreEnc.getMasterKeyName());
w.writeInt(keystoreEnc.getKeySize());
w.writeString(keystoreEnc.getKeyStorePath());
w.writeCharArray(keystoreEnc.getKeyStorePwd());
}
Aggregations