Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 507E2200C41 for ; Fri, 24 Mar 2017 18:17:40 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4E507160B93; Fri, 24 Mar 2017 17:17:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 85A3D160B96 for ; Fri, 24 Mar 2017 18:17:39 +0100 (CET) Received: (qmail 82351 invoked by uid 500); 24 Mar 2017 17:17:38 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 82309 invoked by uid 99); 24 Mar 2017 17:17:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Mar 2017 17:17:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E280CDFFDA; Fri, 24 Mar 2017 17:17:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aweisberg@apache.org To: commits@cassandra.apache.org Date: Fri, 24 Mar 2017 17:17:38 -0000 Message-Id: In-Reply-To: <72be6433a2d14244a1fb13a1a5c5a556@git.apache.org> References: <72be6433a2d14244a1fb13a1a5c5a556@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] cassandra git commit: Avoid seeding /dev/urandom on OS X by specifying SHA1PRNG in CipherFactoryTest. archived-at: Fri, 24 Mar 2017 17:17:40 -0000 Avoid seeding /dev/urandom on OS X by specifying SHA1PRNG in CipherFactoryTest. Patch by Jay Zhuang; Reviewed by Ariel Weisberg for CASSANDRA-13370 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ee7023e3 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ee7023e3 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ee7023e3 Branch: refs/heads/trunk Commit: ee7023e324cdd3b3442b04ad4b0b1f4b33921d35 Parents: a10b807 Author: Jay Zhuang Authored: Fri Mar 24 13:08:50 2017 -0400 Committer: Ariel Weisberg Committed: Fri Mar 24 13:08:50 2017 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/security/CipherFactoryTest.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/ee7023e3/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 8b13109..071dd1a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.11.0 + * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370) * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247) * Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317) * Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366) http://git-wip-us.apache.org/repos/asf/cassandra/blob/ee7023e3/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 4ba265e..29302b7 100644 --- a/test/unit/org/apache/cassandra/security/CipherFactoryTest.java +++ b/test/unit/org/apache/cassandra/security/CipherFactoryTest.java @@ -21,6 +21,7 @@ package org.apache.cassandra.security; import java.io.IOException; +import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.BadPaddingException; @@ -34,6 +35,9 @@ import org.junit.Test; import org.apache.cassandra.config.TransparentDataEncryptionOptions; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + public class CipherFactoryTest { // http://www.gutenberg.org/files/4300/4300-h/4300-h.htm @@ -47,7 +51,18 @@ public class CipherFactoryTest @Before public void setup() { - secureRandom = new SecureRandom(new byte[] {0,1,2,3,4,5,6,7,8,9} ); + try + { + secureRandom = SecureRandom.getInstance("SHA1PRNG"); + assertNotNull(secureRandom.getProvider()); + } + catch (NoSuchAlgorithmException e) + { + fail("NoSuchAlgorithmException: SHA1PRNG not found."); + } + long seed = new java.util.Random().nextLong(); + System.out.println("Seed: " + seed); + secureRandom.setSeed(seed); encryptionOptions = EncryptionContextGenerator.createEncryptionOptions(); cipherFactory = new CipherFactory(encryptionOptions); }