Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setEncryptionEnabled()

The following examples show how to use org.apache.ignite.configuration.CacheConfiguration#setEncryptionEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EncryptedCacheNodeJoinTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
protected CacheConfiguration cacheConfiguration(String gridName) {
    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setName(cacheName());
    ccfg.setEncryptionEnabled(gridName.equals(GRID_0));

    return ccfg;
}
 
Example 2
Source File: WalRecoveryWithPageCompressionAndTdeTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    for (CacheConfiguration<?, ?> ccfg : cfg.getCacheConfiguration())
        ccfg.setEncryptionEnabled(true);

    KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();

    encSpi.setKeyStorePath(AbstractEncryptionTest.KEYSTORE_PATH);
    encSpi.setKeyStorePassword(AbstractEncryptionTest.KEYSTORE_PASSWORD.toCharArray());

    cfg.setEncryptionSpi(encSpi);

    return cfg;
}
 
Example 3
Source File: EncryptedCacheCreateTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** @throws Exception If failed. */
@Test
public void testCreateEncryptedCache() throws Exception {
    CacheConfiguration<Long, String> ccfg = new CacheConfiguration<>(ENCRYPTED_CACHE);

    ccfg.setEncryptionEnabled(true);

    IgniteEx grid = grid(0);

    grid.createCache(ccfg);

    IgniteInternalCache<Object, Object> enc = grid.cachex(ENCRYPTED_CACHE);

    assertNotNull(enc);

    KeystoreEncryptionKey key =
        (KeystoreEncryptionKey)grid.context().encryption().groupKey(CU.cacheGroupId(ENCRYPTED_CACHE, null));

    assertNotNull(key);
    assertNotNull(key.key());
}
 
Example 4
Source File: EncryptedCacheGroupCreateTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** @throws Exception If failed. */
@Test
public void testCreateEncryptedCacheGroup() throws Exception {
    KeystoreEncryptionKey key = createEncryptedCache(ENCRYPTED_CACHE, ENCRYPTED_GROUP);

    CacheConfiguration<Long, String> ccfg = new CacheConfiguration<>(ENCRYPTED_CACHE + "2");

    ccfg.setEncryptionEnabled(true);
    ccfg.setGroupName(ENCRYPTED_GROUP);

    IgniteEx grid = grid(0);

    grid.createCache(ccfg);

    IgniteInternalCache<Object, Object> encrypted2 = grid.cachex(ENCRYPTED_CACHE + "2");

    GridEncryptionManager encMgr = encrypted2.context().kernalContext().encryption();

    KeystoreEncryptionKey key2 = (KeystoreEncryptionKey)encMgr.groupKey(CU.cacheGroupId(ENCRYPTED_CACHE, ENCRYPTED_GROUP));

    assertNotNull(key2);
    assertNotNull(key2.key());

    assertEquals(key.key(), key2.key());
}
 
Example 5
Source File: EncryptedCacheGroupCreateTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** */
private KeystoreEncryptionKey createEncryptedCache(String cacheName, String grpName) {
    CacheConfiguration<Long, String> ccfg = new CacheConfiguration<>(cacheName);

    ccfg.setEncryptionEnabled(true);
    ccfg.setGroupName(grpName);

    IgniteEx grid = grid(0);

    grid.createCache(ccfg);

    IgniteInternalCache<Object, Object> enc = grid.cachex(cacheName);

    assertNotNull(enc);

    KeystoreEncryptionKey key =
        (KeystoreEncryptionKey)grid.context().encryption().groupKey(CU.cacheGroupId(cacheName, grpName));

    assertNotNull(key);
    assertNotNull(key.key());

    return key;
}