accumulo-notifications mailing list archives

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

 ##########
 File path: core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
 ##########
 @@ -396,6 +396,124 @@ public void AESGCM_Encryption_Test_Tag_Integrity_Compromised() throws
IOExceptio
     testDecryption(conf, encryptedBytes);
   }
 
+  @Test
+  public void testIVIncrements() {
+    // One byte
+    byte[] testIv1 = new byte[1];
+    testIv1[0] = (byte) 0xFE;
+    // 11111110
+
+    CryptoModuleParameters.incrementIV(testIv1, 0);
+    // 11111111
+
+    assertEquals(testIv1[0], (byte) 0xFF);
+    CryptoModuleParameters.incrementIV(testIv1, 0);
+    // 00000000
+    assertEquals(testIv1[0], (byte) 0x00);
+
+    // Two bytes
+    byte[] testIv2 = new byte[2];
+    testIv2[0] = (byte) 0x00;
+    testIv2[1] = (byte) 0xFE;
+    // 00000000 11111110
+
+    CryptoModuleParameters.incrementIV(testIv2, testIv2.length - 1);
+    // 00000000 11111111
+    assertEquals(testIv2[0], (byte) 0x00);
+    assertEquals(testIv2[1], (byte) 0xFF);
+
+    CryptoModuleParameters.incrementIV(testIv2, testIv2.length - 1);
+    // 00000001 00000000
+    assertEquals(testIv2[0], (byte) 0x01);
+    assertEquals(testIv2[1], (byte) 0x00);
+
+    CryptoModuleParameters.incrementIV(testIv2, testIv2.length - 1);
+    // 00000001 00000001
+    assertEquals(testIv2[0], (byte) 0x01);
 
 Review comment:
   I think there's an assertArrayEquals, which might help streamline these assertions.

----------------------------------------------------------------
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