You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/12/12 12:21:09 UTC

[commons-crypto] branch master updated (48ae8fe -> 951732d)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


    from 48ae8fe  Sort members
     new 359140e  Normalize name in test
     new 6c7e85a  Format
     new b1e9ae6  Format
     new e21eade  Format
     new 9b1d1b0  Better name
     new 951732d  Comments

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/crypto/cipher/CryptoCipherFactory.java |  6 ++--
 .../commons/crypto/random/CryptoRandomFactory.java | 10 +++---
 .../commons/crypto/random/AbstractRandom.java      |  5 ++-
 .../commons/crypto/random/AbstractRandomTest.java  | 40 ++++++++++------------
 .../crypto/random/CryptoRandomFactoryTest.java     | 40 +++++++++++-----------
 5 files changed, 47 insertions(+), 54 deletions(-)


[commons-crypto] 01/06: Normalize name in test

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit 359140e1da71b641b9b1497a171ed8700526acbf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:06:04 2022 -0500

    Normalize name in test
---
 .../crypto/random/CryptoRandomFactoryTest.java     | 40 +++++++++++-----------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/random/CryptoRandomFactoryTest.java b/src/test/java/org/apache/commons/crypto/random/CryptoRandomFactoryTest.java
index c3b08d5..7a43af7 100644
--- a/src/test/java/org/apache/commons/crypto/random/CryptoRandomFactoryTest.java
+++ b/src/test/java/org/apache/commons/crypto/random/CryptoRandomFactoryTest.java
@@ -33,17 +33,17 @@ public class CryptoRandomFactoryTest {
 
     @Test
     public void testAbstractRandom() {
-        final Properties props = new Properties();
-        props.setProperty(CryptoRandomFactory.CLASSES_KEY, AbstractRandom.class.getName());
-        final Exception ex = assertThrows(GeneralSecurityException.class, () -> CryptoRandomFactory.getCryptoRandom(props));
+        final Properties properties = new Properties();
+        properties.setProperty(CryptoRandomFactory.CLASSES_KEY, AbstractRandom.class.getName());
+        final Exception ex = assertThrows(GeneralSecurityException.class, () -> CryptoRandomFactory.getCryptoRandom(properties));
         final String message = ex.getMessage();
         assertTrue(message.contains("InstantiationException"), message);
     }
 
     @Test
     public void testDefaultRandom() throws GeneralSecurityException, IOException {
-        final Properties props = new Properties();
-        try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(props)) {
+        final Properties properties = new Properties();
+        try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
             final String name = random.getClass().getName();
             if (OpenSslCryptoRandom.isNativeCodeEnabled()) {
                 assertEquals(OpenSslCryptoRandom.class.getName(), name);
@@ -62,25 +62,25 @@ public class CryptoRandomFactoryTest {
 
     @Test
     public void testDummmyRandom() {
-        final Properties props = new Properties();
-        props.setProperty(CryptoRandomFactory.CLASSES_KEY, DummyRandom.class.getName());
-        final Exception ex = assertThrows(GeneralSecurityException.class, () -> CryptoRandomFactory.getCryptoRandom(props));
+        final Properties properties = new Properties();
+        properties.setProperty(CryptoRandomFactory.CLASSES_KEY, DummyRandom.class.getName());
+        final Exception ex = assertThrows(GeneralSecurityException.class, () -> CryptoRandomFactory.getCryptoRandom(properties));
         final String message = ex.getMessage();
         assertTrue(message.contains("NoSuchMethodException"), message);
     }
 
     @Test
     public void testEmpty() throws Exception {
-        final Properties props = new Properties();
-        props.setProperty(CryptoRandomFactory.CLASSES_KEY, "");
-        CryptoRandomFactory.getCryptoRandom(props).close();
+        final Properties properties = new Properties();
+        properties.setProperty(CryptoRandomFactory.CLASSES_KEY, "");
+        CryptoRandomFactory.getCryptoRandom(properties).close();
     }
 
     @Test
     public void testFailingRandom() {
-        final Properties props = new Properties();
-        props.setProperty(CryptoRandomFactory.CLASSES_KEY, FailingRandom.class.getName());
-        final Exception ex = assertThrows(GeneralSecurityException.class, () -> CryptoRandomFactory.getCryptoRandom(props));
+        final Properties properties = new Properties();
+        properties.setProperty(CryptoRandomFactory.CLASSES_KEY, FailingRandom.class.getName());
+        final Exception ex = assertThrows(GeneralSecurityException.class, () -> CryptoRandomFactory.getCryptoRandom(properties));
 
         Throwable cause = ex.getCause();
         assertEquals(IllegalArgumentException.class, cause.getClass());
@@ -103,9 +103,9 @@ public class CryptoRandomFactoryTest {
     public void testGetOSRandom() throws GeneralSecurityException, IOException {
         // Windows does not have a /dev/random device
         assumeTrue(!System.getProperty("os.name").contains("Windows"));
-        final Properties props = new Properties();
-        props.setProperty(CryptoRandomFactory.CLASSES_KEY, CryptoRandomFactory.RandomProvider.OS.getClassName());
-        try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(props)) {
+        final Properties properties = new Properties();
+        properties.setProperty(CryptoRandomFactory.CLASSES_KEY, CryptoRandomFactory.RandomProvider.OS.getClassName());
+        try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
             assertEquals(OsCryptoRandom.class.getName(), random.getClass().getName());
         }
     }
@@ -129,11 +129,11 @@ public class CryptoRandomFactoryTest {
 
     @Test
     public void testNoClasses() {
-        final Properties props = new Properties();
+        final Properties properties = new Properties();
         // An empty string currently means use the default
         // However the splitter drops empty fields
-        props.setProperty(CryptoRandomFactory.CLASSES_KEY, ",");
-        assertThrows(IllegalArgumentException.class, () -> CryptoRandomFactory.getCryptoRandom(props));
+        properties.setProperty(CryptoRandomFactory.CLASSES_KEY, ",");
+        assertThrows(IllegalArgumentException.class, () -> CryptoRandomFactory.getCryptoRandom(properties));
     }
 
     @Test


[commons-crypto] 02/06: Format

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit 6c7e85afe4d9fc570aef73c110744e3369e82caf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:09:18 2022 -0500

    Format
---
 .../org/apache/commons/crypto/random/CryptoRandomFactory.java  | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java b/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
index 9ea4d3b..9a60d79 100644
--- a/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
+++ b/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
@@ -34,8 +34,7 @@ public class CryptoRandomFactory {
     /**
      * The configuration key of the file path for secure random device.
      */
-    public static final String DEVICE_FILE_PATH_KEY = Crypto.CONF_PREFIX
-            + "secure.random.device.file.path";
+    public static final String DEVICE_FILE_PATH_KEY = Crypto.CONF_PREFIX + "secure.random.device.file.path";
 
     /**
      * The default value ({@value}) of the file path for secure random device.
@@ -46,8 +45,7 @@ public class CryptoRandomFactory {
     /**
      * The configuration key of the algorithm of secure random.
      */
-    public static final String JAVA_ALGORITHM_KEY = Crypto.CONF_PREFIX
-            + "secure.random.java.algorithm";
+    public static final String JAVA_ALGORITHM_KEY = Crypto.CONF_PREFIX + "secure.random.java.algorithm";
 
     /**
      * The default value ({@value}) of the algorithm of secure random.
@@ -68,8 +66,8 @@ public class CryptoRandomFactory {
      * The value can also be a comma-separated list of class names in
      * order of descending priority.
      */
-    public static final String CLASSES_KEY = Crypto.CONF_PREFIX
-            + "secure.random.classes";
+    public static final String CLASSES_KEY = Crypto.CONF_PREFIX + "secure.random.classes";
+
     /**
      * Defines the internal CryptoRandom implementations.
      * <p>


[commons-crypto] 05/06: Better name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit 9b1d1b042d5637e0770f71c64d6d30d0b871dab2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:20:40 2022 -0500

    Better name
---
 src/test/java/org/apache/commons/crypto/random/AbstractRandom.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java b/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java
index da1ac04..bd1393b 100644
--- a/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java
+++ b/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java
@@ -25,7 +25,7 @@ import java.util.Properties;
 abstract class AbstractRandom implements CryptoRandom {
 
     // Should fail to instantiate, as it is an abstract class
-    AbstractRandom(final Properties props) {
+    AbstractRandom(final Properties properties) {
 
     }
 }


[commons-crypto] 04/06: Format

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit e21eadec21da69ebdc7761fc139e6a0b8e44a363
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:18:41 2022 -0500

    Format
---
 .../commons/crypto/random/AbstractRandomTest.java  | 40 ++++++++++------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/random/AbstractRandomTest.java b/src/test/java/org/apache/commons/crypto/random/AbstractRandomTest.java
index ee3e6d3..0981d40 100644
--- a/src/test/java/org/apache/commons/crypto/random/AbstractRandomTest.java
+++ b/src/test/java/org/apache/commons/crypto/random/AbstractRandomTest.java
@@ -1,20 +1,20 @@
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.apache.commons.crypto.random;
 
 import java.lang.Thread.State;
@@ -29,8 +29,7 @@ import org.junit.jupiter.api.Timeout;
 
 public abstract class AbstractRandomTest {
 
-    public abstract CryptoRandom getCryptoRandom()
-            throws GeneralSecurityException;
+    public abstract CryptoRandom getCryptoRandom() throws GeneralSecurityException;
 
     @Test
     @Timeout(value = 120000, unit = TimeUnit.MILLISECONDS)
@@ -74,8 +73,7 @@ public abstract class AbstractRandomTest {
     }
 
     /**
-     * Test will timeout if secure random implementation always returns a
-     * constant value.
+     * Test will timeout if secure random implementation always returns a constant value.
      */
     private void checkRandomBytes(final CryptoRandom random, final int len) {
         final byte[] bytes = new byte[len];


[commons-crypto] 03/06: Format

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit b1e9ae6fa7b8127ef1e8faf804817fe4041ec072
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:14:21 2022 -0500

    Format
---
 .../java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
index e86c969..8f57435 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
@@ -33,8 +33,7 @@ public class CryptoCipherFactory {
     /**
      * The configuration key of the provider class for JCE cipher.
      */
-    public static final String JCE_PROVIDER_KEY = Crypto.CONF_PREFIX
-            + "cipher.jce.provider";
+    public static final String JCE_PROVIDER_KEY = Crypto.CONF_PREFIX + "cipher.jce.provider";
     /**
      * The configuration key of the CryptoCipher implementation class.
      * <p>
@@ -49,8 +48,7 @@ public class CryptoCipherFactory {
      * order of descending priority.
      */
 
-    public static final String CLASSES_KEY = Crypto.CONF_PREFIX
-            + "cipher.classes";
+    public static final String CLASSES_KEY = Crypto.CONF_PREFIX + "cipher.classes";
 
     /**
      * Defines the internal CryptoCipher implementations.


[commons-crypto] 06/06: Comments

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit 951732d601a2415f2952b48515334d88e105f103
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:21:04 2022 -0500

    Comments
---
 src/test/java/org/apache/commons/crypto/random/AbstractRandom.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java b/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java
index bd1393b..5432f4d 100644
--- a/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java
+++ b/src/test/java/org/apache/commons/crypto/random/AbstractRandom.java
@@ -24,8 +24,7 @@ import java.util.Properties;
  */
 abstract class AbstractRandom implements CryptoRandom {
 
-    // Should fail to instantiate, as it is an abstract class
     AbstractRandom(final Properties properties) {
-
+        // empty
     }
 }