accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] keith-turner commented on a change in pull request #322: ACCUMULO-4740 Enable GCM mode for crypto
Date Thu, 01 Jan 1970 00:00:00 GMT
keith-turner commented on a change in pull request #322: ACCUMULO-4740 Enable GCM mode for
crypto
URL: https://github.com/apache/accumulo/pull/322#discussion_r152382623
 
 

 ##########
 File path: core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
 ##########
 @@ -357,14 +363,209 @@ public void testKeyWrapAndUnwrap() throws NoSuchAlgorithmException,
NoSuchPaddin
     byte[] wrappedKey = keyWrapCipher.wrap(randKey);
 
     assert (wrappedKey != null);
-    assert (wrappedKey.length == randomKey.length);
+    // AESWrap will produce 24 bytes given 128 bits of key data with a 128-bit KEK
+    assert (wrappedKey.length == randomKey.length + 8);
 
-    Cipher keyUnwrapCipher = Cipher.getInstance("AES/ECB/NoPadding");
+    Cipher keyUnwrapCipher = Cipher.getInstance("AESWrap/ECB/NoPadding");
     keyUnwrapCipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(kek, "AES"));
     Key unwrappedKey = keyUnwrapCipher.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY);
 
     byte[] unwrappedKeyBytes = unwrappedKey.getEncoded();
     assert (Arrays.equals(unwrappedKeyBytes, randomKey));
 
   }
+
+  @Test
+  public void AESGCM_Encryption_Test_Correct_Encryption_And_Decryption() throws IOException,
AEADBadTagException {
+    AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
+    byte[] encryptedBytes = testEncryption(conf, new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 20});
+    Integer result = testDecryption(conf, encryptedBytes);
+    assert (result.equals(1));
 
 Review comment:
   should use assertTrue or assertEquals

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message