You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2015/08/06 16:08:49 UTC

[2/5] cassandra git commit: Revert "ninja-fix an assert in CipherFactory, and added tests for it"

Revert "ninja-fix an assert in CipherFactory, and added tests for it"

This reverts commit f54580d0715a9189ba1658ad036e7d19cecdc3c8.


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f8ccb39e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f8ccb39e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f8ccb39e

Branch: refs/heads/cassandra-3.0
Commit: f8ccb39ec4884023693925b3982d23a864a8d717
Parents: 0dd50a6
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Thu Aug 6 15:22:03 2015 +0200
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Thu Aug 6 16:08:05 2015 +0200

----------------------------------------------------------------------
 .../org/apache/cassandra/security/CipherFactory.java    |  2 +-
 .../apache/cassandra/security/CipherFactoryTest.java    | 12 ------------
 2 files changed, 1 insertion(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8ccb39e/src/java/org/apache/cassandra/security/CipherFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/security/CipherFactory.java b/src/java/org/apache/cassandra/security/CipherFactory.java
index 7c1495a..0ff9867 100644
--- a/src/java/org/apache/cassandra/security/CipherFactory.java
+++ b/src/java/org/apache/cassandra/security/CipherFactory.java
@@ -109,7 +109,7 @@ public class CipherFactory
 
     public Cipher getDecryptor(String transformation, String keyAlias, byte[] iv) throws IOException
     {
-        assert iv != null && iv.length > 0 : "trying to decrypt, but the initialization vector is empty";
+        assert iv != null || iv.length > 0 : "trying to decrypt, but the initialization vector is empty";
         return buildCipher(transformation, keyAlias, iv, Cipher.DECRYPT_MODE);
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8ccb39e/test/unit/org/apache/cassandra/security/CipherFactoryTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/security/CipherFactoryTest.java b/test/unit/org/apache/cassandra/security/CipherFactoryTest.java
index bb6f7ce..4239973 100644
--- a/test/unit/org/apache/cassandra/security/CipherFactoryTest.java
+++ b/test/unit/org/apache/cassandra/security/CipherFactoryTest.java
@@ -84,16 +84,4 @@ public class CipherFactoryTest
         Cipher c2 = cipherFactory.buildCipher(encryptionOptions.cipher, EncryptionContextGenerator.KEY_ALIAS_2, nextIV(), Cipher.DECRYPT_MODE);
         Assert.assertFalse(c1 == c2);
     }
-
-    @Test(expected = AssertionError.class)
-    public void getDecryptor_NullIv() throws IOException
-    {
-        cipherFactory.getDecryptor(encryptionOptions.cipher, encryptionOptions.key_alias, null);
-    }
-
-    @Test(expected = AssertionError.class)
-    public void getDecryptor_EmptyIv() throws IOException
-    {
-        cipherFactory.getDecryptor(encryptionOptions.cipher, encryptionOptions.key_alias, new byte[0]);
-    }
 }