use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionKey in project ignite by apache.
the class KeystoreEncryptionSpiSelfTest method checkKeyEncryptDecrypt.
/**
*/
private void checkKeyEncryptDecrypt(EncryptionSpi encSpi, KeystoreEncryptionKey k) {
byte[] encGrpKey = encSpi.encryptKey(k);
assertNotNull(encGrpKey);
assertTrue(encGrpKey.length > 0);
KeystoreEncryptionKey k2 = (KeystoreEncryptionKey) encSpi.decryptKey(encGrpKey);
assertEquals(k.key(), k2.key());
}
use of org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionKey in project ignite by apache.
the class SpringEncryptedCacheRestartTest method testEncryptionKeysEqualsOnThirdNodeJoin.
/**
* @throws Exception If failed.
*/
@Test
public void testEncryptionKeysEqualsOnThirdNodeJoin() throws Exception {
T2<IgniteEx, IgniteEx> g = startTestGrids(true);
IgniteEx g2 = (IgniteEx) IgnitionEx.start(IgniteUtils.resolveIgnitePath("modules/spring/src/test/config/enc/enc-group-2.xml").getAbsolutePath(), "grid-2");
Collection<String> cacheNames = Arrays.asList("encrypted", "encrypted-2");
for (String cacheName : cacheNames) {
IgniteInternalCache<Object, Object> enc = g.get1().cachex(cacheName);
assertNotNull(enc);
int grpId = CU.cacheGroupId(enc.name(), enc.configuration().getGroupName());
GroupKey grpKey0 = g.get1().context().encryption().getActiveKey(grpId);
GroupKey grpKey1 = g.get2().context().encryption().getActiveKey(grpId);
GroupKey grpKey2 = g2.context().encryption().getActiveKey(grpId);
assertNotNull(cacheName, grpKey0);
assertNotNull(cacheName, grpKey1);
assertNotNull(cacheName, grpKey2);
KeystoreEncryptionKey key0 = (KeystoreEncryptionKey) grpKey0.key();
KeystoreEncryptionKey key1 = (KeystoreEncryptionKey) grpKey1.key();
KeystoreEncryptionKey key2 = (KeystoreEncryptionKey) grpKey2.key();
assertNotNull(cacheName, key0.key());
assertNotNull(cacheName, key1.key());
assertNotNull(cacheName, key2.key());
assertNotNull(cacheName, key0.key());
assertNotNull(cacheName, key1.key());
assertNotNull(cacheName, key2.key());
assertEquals(cacheName, key0.key(), key1.key());
assertEquals(cacheName, key1.key(), key2.key());
}
}
Aggregations