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:50:13 UTC

[commons-crypto] branch master updated (b8105d9 -> 4ca5371)

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 b8105d9  Add missing tests
     new b64c29c  Javadoc
     new 46fc17a  Javadoc
     new 32686c7  Format
     new 772fb99  Add missing tests
     new 4ca5371  Format and Javadoc

The 5 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:
 .../apache/commons/crypto/cipher/CryptoCipher.java |  2 +
 .../commons/crypto/cipher/CryptoCipherFactory.java |  9 +++-
 .../commons/crypto/random/CryptoRandomFactory.java |  2 +-
 .../org/apache/commons/crypto/utils/EnumTest.java  | 61 ++++++++++++++--------
 4 files changed, 50 insertions(+), 24 deletions(-)


[commons-crypto] 04/05: Add missing tests

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 772fb99f019e435245565aa6612fae667bccaa26
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:49:01 2022 -0500

    Add missing tests
---
 .../org/apache/commons/crypto/utils/EnumTest.java  | 27 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/utils/EnumTest.java b/src/test/java/org/apache/commons/crypto/utils/EnumTest.java
index dca4b60..194de85 100644
--- a/src/test/java/org/apache/commons/crypto/utils/EnumTest.java
+++ b/src/test/java/org/apache/commons/crypto/utils/EnumTest.java
@@ -17,8 +17,13 @@
 */
 package org.apache.commons.crypto.utils;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.commons.crypto.cipher.CryptoCipher;
 import org.apache.commons.crypto.cipher.CryptoCipherFactory;
 import org.apache.commons.crypto.cipher.CryptoCipherFactory.CipherProvider;
+import org.apache.commons.crypto.random.CryptoRandom;
 import org.apache.commons.crypto.random.CryptoRandomFactory;
 import org.apache.commons.crypto.random.CryptoRandomFactory.RandomProvider;
 import org.junit.jupiter.api.Test;
@@ -28,17 +33,31 @@ import org.junit.jupiter.api.Test;
  */
 public class EnumTest {
 
+    private void checkImplClass(final CipherProvider value) {
+        final Class<? extends CryptoCipher> implClass = value.getImplClass();
+        assertTrue(CryptoCipher.class.isAssignableFrom(implClass), implClass.toString());
+        assertEquals(value.getClassName(), implClass.getName());
+    }
+
+    private void checkImplClass(final RandomProvider value) {
+        final Class<? extends CryptoRandom> implClass = value.getImplClass();
+        assertTrue(CryptoRandom.class.isAssignableFrom(implClass), implClass.toString());
+        assertEquals(value.getClassName(), implClass.getName());
+    }
+
     @Test
-    public void testRandom() throws Exception {
-        for (final RandomProvider value : CryptoRandomFactory.RandomProvider.values()) {
+    public void testCipher() throws Exception {
+        for (final CipherProvider value : CryptoCipherFactory.CipherProvider.values()) {
             ReflectionUtils.getClassByName(value.getClassName());
+            checkImplClass(value);
         }
     }
 
     @Test
-    public void testCipher() throws Exception {
-        for (final CipherProvider value : CryptoCipherFactory.CipherProvider.values()) {
+    public void testRandom() throws Exception {
+        for (final RandomProvider value : CryptoRandomFactory.RandomProvider.values()) {
             ReflectionUtils.getClassByName(value.getClassName());
+            checkImplClass(value);
         }
     }
 


[commons-crypto] 05/05: Format and Javadoc

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 4ca5371380864ebed00e360256a24b778334f764
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:50:09 2022 -0500

    Format and Javadoc
---
 .../java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java   | 5 ++---
 .../java/org/apache/commons/crypto/random/CryptoRandomFactory.java   | 2 +-
 2 files changed, 3 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 f74f1c5..96578c7 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
@@ -26,7 +26,7 @@ import org.apache.commons.crypto.utils.ReflectionUtils;
 import org.apache.commons.crypto.utils.Utils;
 
 /**
- * This is the factory class used for creating {@link CryptoCipher} instances.
+ * Creates {@link CryptoCipher} instances.
  */
 public class CryptoCipherFactory {
 
@@ -34,6 +34,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";
+
     /**
      * The configuration key of the CryptoCipher implementation class.
      * <p>
@@ -49,7 +50,6 @@ public class CryptoCipherFactory {
      * order of descending priority.
      * </p>
      */
-
     public static final String CLASSES_KEY = Crypto.CONF_PREFIX + "cipher.classes";
 
     /**
@@ -62,7 +62,6 @@ public class CryptoCipherFactory {
      * props.setProperty(...); // if required by the implementation
      * cipher = CryptoCipherFactory.getInstance(transformation, props);
      * </pre></blockquote>
-     * </p>
      */
     public enum CipherProvider {
 
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 9a60d79..312cb9f 100644
--- a/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
+++ b/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
@@ -26,7 +26,7 @@ import org.apache.commons.crypto.utils.ReflectionUtils;
 import org.apache.commons.crypto.utils.Utils;
 
 /**
- * This is the factory class used for creating {@link CryptoRandom} instances
+ * Creates {@link CryptoRandom} instances
  */
 public class CryptoRandomFactory {
 


[commons-crypto] 01/05: Javadoc

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 b64c29c0b3cec63ea9a8159860ffd43452f5a1d6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:31:01 2022 -0500

    Javadoc
---
 src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java
index b7cda6e..1c65c00 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java
@@ -164,6 +164,7 @@ public interface CryptoCipher extends Closeable {
      * GCM mode, all AAD must be supplied before beginning
      * operations on the ciphertext (via the {@code update} and
      * {@code doFinal} methods).
+     * </p>
      *
      * @param aad the buffer containing the Additional Authentication Data
      *
@@ -192,6 +193,7 @@ public interface CryptoCipher extends Closeable {
      * GCM mode, all AAD must be supplied before beginning
      * operations on the ciphertext (via the {@code update} and
      * {@code doFinal} methods).
+     * </p>
      *
      * @param aad the buffer containing the Additional Authentication Data
      *


[commons-crypto] 03/05: 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 32686c7577d0e6f6b65e8af0a0b267f3c1199e1a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:33:16 2022 -0500

    Format
---
 .../org/apache/commons/crypto/utils/EnumTest.java  | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/utils/EnumTest.java b/src/test/java/org/apache/commons/crypto/utils/EnumTest.java
index 392ba5e..dca4b60 100644
--- a/src/test/java/org/apache/commons/crypto/utils/EnumTest.java
+++ b/src/test/java/org/apache/commons/crypto/utils/EnumTest.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.utils;
 
 import org.apache.commons.crypto.cipher.CryptoCipherFactory;
@@ -30,14 +30,14 @@ public class EnumTest {
 
     @Test
     public void testRandom() throws Exception {
-        for(final RandomProvider value : CryptoRandomFactory.RandomProvider.values()) {
+        for (final RandomProvider value : CryptoRandomFactory.RandomProvider.values()) {
             ReflectionUtils.getClassByName(value.getClassName());
         }
     }
 
     @Test
     public void testCipher() throws Exception {
-        for(final CipherProvider value : CryptoCipherFactory.CipherProvider.values()) {
+        for (final CipherProvider value : CryptoCipherFactory.CipherProvider.values()) {
             ReflectionUtils.getClassByName(value.getClassName());
         }
     }


[commons-crypto] 02/05: Javadoc

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 46fc17a571b019fda4312003820482a2573f13ad
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:32:22 2022 -0500

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

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 8f57435..f74f1c5 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
@@ -43,9 +43,11 @@ public class CryptoCipherFactory {
      * The internal classes are listed in the enum
      * {@link CipherProvider CipherProvider}
      * which can be used to obtain the full class name.
+     * </p>
      * <p>
      * The value can also be a comma-separated list of class names in
      * order of descending priority.
+     * </p>
      */
 
     public static final String CLASSES_KEY = Crypto.CONF_PREFIX + "cipher.classes";
@@ -54,11 +56,13 @@ public class CryptoCipherFactory {
      * Defines the internal CryptoCipher implementations.
      * <p>
      * Usage:
+     * </p>
      * <blockquote><pre>
      * props.setProperty(CryptoCipherFactory.CLASSES_KEY, CipherProvider.OPENSSL.getClassName());
      * props.setProperty(...); // if required by the implementation
      * cipher = CryptoCipherFactory.getInstance(transformation, props);
      * </pre></blockquote>
+     * </p>
      */
     public enum CipherProvider {
 
@@ -66,6 +70,7 @@ public class CryptoCipherFactory {
          * The OpenSSL cipher implementation (using JNI)
          * <p>
          * This implementation does not use any properties
+         * </p>
          */
         // Please ensure the property description agrees with the implementation
         OPENSSL(OpenSslCipher.class),
@@ -75,6 +80,7 @@ public class CryptoCipherFactory {
          * <p>
          * uses the property {@link #JCE_PROVIDER_KEY}
          * to define the provider name, if present.
+         * </p>
          */
         // Please ensure the property description agrees with the implementation
         JCE(JceCipher.class);