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

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


The following commit(s) were added to refs/heads/master by this push:
     new fb232605 CRYPTO-177: include JNA in Factory options
fb232605 is described below

commit fb232605ec852ee964f0369b4980fe69725018f3
Author: Sebb <s...@apache.org>
AuthorDate: Sun Nov 19 12:36:58 2023 +0000

    CRYPTO-177: include JNA in Factory options
---
 src/changes/changes.xml                                       |  1 +
 .../org/apache/commons/crypto/cipher/CryptoCipherFactory.java | 11 +++++++++++
 .../org/apache/commons/crypto/random/CryptoRandomFactory.java | 10 ++++++++++
 3 files changed, 22 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2520f83f..ccbcc679 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -95,6 +95,7 @@
       <action                    type="update" dev="ggregory" 
due-to="Dependabot, Gary Gregory">Bump commons-parent from 56 to 64 
#225.</action>
       <action                    type="update" dev="ggregory" due-to="Gary 
Gregory">Bump com.sun.xml.bind:jaxb-impl from 2.3.7 to 2.3.8.</action>
       <!-- ADD -->
+      <action issue="CRYPTO-177" type="add" dev="sebb">Cipher and Random 
Factory classes don't include JNA</action>
       <action issue="CRYPTO-172" type="add" dev="sebb" due-to="Ludovic 
Henry">Add support for Linux-riscv64 #264</action>
       <action issue="CRYPTO-174" type="add" dev="sebb">Allow override of SSL 
library name for Windows</action>
     </release>
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 c3fbdf9e..0428708c 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipherFactory.java
@@ -24,6 +24,7 @@ import java.util.Properties;
 import org.apache.commons.crypto.Crypto;
 import org.apache.commons.crypto.utils.ReflectionUtils;
 import org.apache.commons.crypto.utils.Utils;
+import org.apache.commons.crypto.jna.OpenSslJna;
 
 /**
  * Creates {@link CryptoCipher} instances.
@@ -52,6 +53,15 @@ public class CryptoCipherFactory {
         // Please ensure the property description agrees with the 
implementation
         OPENSSL(OpenSslCipher.class),
 
+        /**
+         * The OpenSSL cipher implementation (using JNA)
+         * <p>
+         * This implementation does not use any properties
+         * </p>
+         */
+        // Please ensure the property description agrees with the 
implementation
+        JNA(OpenSslJna.getCipherClass()),
+
         /**
          * The JCE cipher implementation from the JVM
          * <p>
@@ -206,3 +216,4 @@ public class CryptoCipherFactory {
     }
 
 }
+
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 8acdf9c8..b8b342d7 100644
--- a/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
+++ b/src/main/java/org/apache/commons/crypto/random/CryptoRandomFactory.java
@@ -24,6 +24,7 @@ import java.util.Properties;
 import org.apache.commons.crypto.Crypto;
 import org.apache.commons.crypto.utils.ReflectionUtils;
 import org.apache.commons.crypto.utils.Utils;
+import org.apache.commons.crypto.jna.OpenSslJna;
 
 /**
  * Creates {@link CryptoRandom} instances
@@ -51,6 +52,15 @@ public class CryptoRandomFactory {
         // Please ensure the property description agrees with the 
implementation
         OPENSSL(OpenSslCryptoRandom.class),
 
+        /**
+         * The OpenSSL Random implementation (using JNA)
+         * <p>
+         * No properties are used for configuration, but they
+         * are passed to the {@link RandomProvider#JAVA} backup implementation
+         */
+        // Please ensure the property description agrees with the 
implementation
+        JNA(OpenSslJna.getRandomClass()),
+
         /**
          * The SecureRandom implementation from the JVM
          * <p>

Reply via email to