accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch master updated: ACCUMULO-4767 (#344)
Date Wed, 20 Dec 2017 00:03:12 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new ad27005  ACCUMULO-4767 (#344)
ad27005 is described below

commit ad270057c62836105328d3df121faaa70703baea
Author: Nick <31989480+PircDef@users.noreply.github.com>
AuthorDate: Tue Dec 19 19:03:10 2017 -0500

    ACCUMULO-4767 (#344)
    
    Removed duplicate code in DefaultCryptoModule
    Added check for existence of array in BlockedOutputStream before using the array in a
stream's flush.
---
 .../apache/accumulo/core/security/crypto/BlockedOutputStream.java  | 3 +++
 .../apache/accumulo/core/security/crypto/DefaultCryptoModule.java  | 7 +------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/security/crypto/BlockedOutputStream.java
b/core/src/main/java/org/apache/accumulo/core/security/crypto/BlockedOutputStream.java
index c929cab..dbbfd84 100644
--- a/core/src/main/java/org/apache/accumulo/core/security/crypto/BlockedOutputStream.java
+++ b/core/src/main/java/org/apache/accumulo/core/security/crypto/BlockedOutputStream.java
@@ -45,6 +45,9 @@ public class BlockedOutputStream extends OutputStream {
 
   @Override
   public synchronized void flush() throws IOException {
+    if (!bb.hasArray()) {
+      throw new RuntimeException("BlockedOutputStream has no backing array.");
+    }
     int size = bb.position();
     if (size == 0)
       return;
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 f0d0a60..c8b3162 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
@@ -211,13 +211,8 @@ public class DefaultCryptoModule implements CryptoModule {
     }
 
     // Get the secret key
-
-    SecureRandom secureRandom = DefaultCryptoModuleUtils.getSecureRandom(params.getRandomNumberGenerator(),
params.getRandomNumberGeneratorProvider());
-
     if (params.getPlaintextKey() == null) {
-      byte[] randomKey = new byte[params.getKeyLength() / 8];
-      secureRandom.nextBytes(randomKey);
-      params.setPlaintextKey(randomKey);
+      params = generateNewRandomSessionKey(params);
     }
 
     // Encrypt the secret key

-- 
To stop receiving notification emails like this one, please contact
['"commits@accumulo.apache.org" <commits@accumulo.apache.org>'].

Mime
View raw message