You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/10/10 19:25:47 UTC

[1/3] git commit: ACCUMULO-3220 Fail fast if the provided cipher isn't a block cipher.

Repository: accumulo
Updated Branches:
  refs/heads/1.6 ccd4897e1 -> e7dc5364d
  refs/heads/master eed30078a -> 300f7941c


ACCUMULO-3220 Fail fast if the provided cipher isn't a block cipher.


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

Branch: refs/heads/1.6
Commit: e7dc5364dbfbfd4f7db35e9f189d6cadd399b399
Parents: ccd4897
Author: Josh Elser <el...@apache.org>
Authored: Fri Oct 10 12:29:55 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Oct 10 12:29:55 2014 -0400

----------------------------------------------------------------------
 .../core/security/crypto/DefaultCryptoModule.java     | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e7dc5364/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java b/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
index dfad05e..0ebbd5d 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
@@ -244,14 +244,18 @@ public class DefaultCryptoModule implements CryptoModule {
       params.setPlaintextOutputStream(new DiscardCloseOutputStream(params.getPlaintextOutputStream()));
     }
 
-    if (params.getCipher() == null) {
+    Cipher cipher = params.getCipher();
+    if (cipher == null) {
       initializeCipher(params);
     }
+
+    if (0 == cipher.getBlockSize()) {
+      throw new RuntimeException("Encryption cipher must be a block cipher");
+    }
     
-    CipherOutputStream cipherOutputStream = new CipherOutputStream(params.getPlaintextOutputStream(), params.getCipher());
-    BlockedOutputStream blockedOutputStream = new BlockedOutputStream(cipherOutputStream, params.getCipher().getBlockSize(), params.getBlockStreamSize());
-    
-    
+    CipherOutputStream cipherOutputStream = new CipherOutputStream(params.getPlaintextOutputStream(), cipher);
+    BlockedOutputStream blockedOutputStream = new BlockedOutputStream(cipherOutputStream, cipher.getBlockSize(), params.getBlockStreamSize());
+
     params.setEncryptedOutputStream(blockedOutputStream);
     
     if (params.getRecordParametersToStream()) {


[2/3] git commit: ACCUMULO-3220 Fail fast if the provided cipher isn't a block cipher.

Posted by el...@apache.org.
ACCUMULO-3220 Fail fast if the provided cipher isn't a block cipher.


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

Branch: refs/heads/master
Commit: e7dc5364dbfbfd4f7db35e9f189d6cadd399b399
Parents: ccd4897
Author: Josh Elser <el...@apache.org>
Authored: Fri Oct 10 12:29:55 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Oct 10 12:29:55 2014 -0400

----------------------------------------------------------------------
 .../core/security/crypto/DefaultCryptoModule.java     | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e7dc5364/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java b/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
index dfad05e..0ebbd5d 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
@@ -244,14 +244,18 @@ public class DefaultCryptoModule implements CryptoModule {
       params.setPlaintextOutputStream(new DiscardCloseOutputStream(params.getPlaintextOutputStream()));
     }
 
-    if (params.getCipher() == null) {
+    Cipher cipher = params.getCipher();
+    if (cipher == null) {
       initializeCipher(params);
     }
+
+    if (0 == cipher.getBlockSize()) {
+      throw new RuntimeException("Encryption cipher must be a block cipher");
+    }
     
-    CipherOutputStream cipherOutputStream = new CipherOutputStream(params.getPlaintextOutputStream(), params.getCipher());
-    BlockedOutputStream blockedOutputStream = new BlockedOutputStream(cipherOutputStream, params.getCipher().getBlockSize(), params.getBlockStreamSize());
-    
-    
+    CipherOutputStream cipherOutputStream = new CipherOutputStream(params.getPlaintextOutputStream(), cipher);
+    BlockedOutputStream blockedOutputStream = new BlockedOutputStream(cipherOutputStream, cipher.getBlockSize(), params.getBlockStreamSize());
+
     params.setEncryptedOutputStream(blockedOutputStream);
     
     if (params.getRecordParametersToStream()) {


[3/3] git commit: Merge branch '1.6'

Posted by el...@apache.org.
Merge branch '1.6'


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

Branch: refs/heads/master
Commit: 300f7941c401c7dbd50492ff2e1a30c073dcca89
Parents: eed3007 e7dc536
Author: Josh Elser <el...@apache.org>
Authored: Fri Oct 10 12:33:03 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Oct 10 12:33:03 2014 -0400

----------------------------------------------------------------------
 .../core/security/crypto/DefaultCryptoModule.java     | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/300f7941/core/src/main/java/org/apache/accumulo/core/security/crypto/DefaultCryptoModule.java
----------------------------------------------------------------------