use of org.apache.ignite.internal.managers.encryption.GroupKey in project gridgain by gridgain.
the class EncryptedCacheGroupCreateTest method createEncryptedCache.
/**
*/
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);
GroupKey grpKey = grid.context().encryption().getActiveKey(CU.cacheGroupId(cacheName, grpName));
assertNotNull(grpKey);
KeystoreEncryptionKey key = (KeystoreEncryptionKey) grpKey.key();
assertNotNull(key);
assertNotNull(key.key());
return key;
}
use of org.apache.ignite.internal.managers.encryption.GroupKey in project gridgain by gridgain.
the class EncryptedCacheRestartTest method testCreateEncryptedCache.
/**
* @throws Exception If failed.
*/
@Test
public void testCreateEncryptedCache() throws Exception {
T2<IgniteEx, IgniteEx> grids = startTestGrids(true);
createEncryptedCache(grids.get1(), grids.get2(), cacheName(), null);
checkEncryptedCaches(grids.get1(), grids.get2());
int grpId = CU.cacheGroupId(cacheName(), null);
KeystoreEncryptionKey keyBeforeRestart = (KeystoreEncryptionKey) grids.get1().context().encryption().getActiveKey(grpId).key();
stopAllGrids();
grids = startTestGrids(false);
checkEncryptedCaches(grids.get1(), grids.get2());
GroupKey grpKeyAfterRestart = grids.get1().context().encryption().getActiveKey(grpId);
assertNotNull(grpKeyAfterRestart);
KeystoreEncryptionKey keyAfterRestart = (KeystoreEncryptionKey) grpKeyAfterRestart.key();
assertNotNull(keyAfterRestart);
assertNotNull(keyAfterRestart.key());
assertEquals(keyBeforeRestart.key(), keyAfterRestart.key());
}
Aggregations