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:57:48 UTC

[commons-crypto] branch master updated (be349ed -> 6b5952f)

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 be349ed  Normalize package-private abstract class name
     new d713871  Format and Javadoc
     new 6b5952f  Javadoc

The 2 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 | 10 ++--
 .../apache/commons/crypto/cipher/JceCipher.java    |  6 +-
 .../commons/crypto/cipher/OpenSslCipher.java       |  6 +-
 .../commons/crypto/cipher/OpenSslCommonMode.java   | 67 +++++++++-------------
 4 files changed, 43 insertions(+), 46 deletions(-)


[commons-crypto] 02/02: 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 6b5952fc7e10b5fd1a6e030588dd2cf7fe74a1b6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:57:44 2022 -0500

    Javadoc
---
 .../java/org/apache/commons/crypto/cipher/CryptoCipher.java    | 10 +++++-----
 src/main/java/org/apache/commons/crypto/cipher/JceCipher.java  |  6 +++++-
 .../java/org/apache/commons/crypto/cipher/OpenSslCipher.java   |  6 +++++-
 3 files changed, 15 insertions(+), 7 deletions(-)

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 1c65c00..e2688e6 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/CryptoCipher.java
@@ -32,10 +32,8 @@ import javax.crypto.ShortBufferException;
  * The interface of cryptographic cipher for encryption and decryption.
  *
  * <p>
- * Note that implementations must provide a constructor that has 2 parameters:
- * <br>
- * a Properties instance and a String (transformation)
- *
+ * Note that implementations must provide a constructor that has 2 parameters: a Properties instance and a String (transformation)
+ * </p>
  */
 public interface CryptoCipher extends Closeable {
 
@@ -50,9 +48,11 @@ public interface CryptoCipher extends Closeable {
     /**
      * Returns the algorithm name of this {@code CryptoCipher} object.
      *
-     * <p>This is the same name that was specified in one of the
+     * <p>
+     * This is the same name that was specified in one of the
      * {@code CryptoCipherFactory#getInstance} calls that created this
      * {@code CryptoCipher} object..
+     * </p>
      *
      * @return the algorithm name of this {@code CryptoCipher} object.
      */
diff --git a/src/main/java/org/apache/commons/crypto/cipher/JceCipher.java b/src/main/java/org/apache/commons/crypto/cipher/JceCipher.java
index 3a81922..3c34076 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/JceCipher.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/JceCipher.java
@@ -68,9 +68,11 @@ class JceCipher implements CryptoCipher {
     /**
      * Returns the algorithm name of this {@code CryptoCipher} object.
      *
-     * <p>This is the same name that was specified in one of the
+     * <p>
+     * This is the same name that was specified in one of the
      * {@code CryptoCipherFactory#getInstance} calls that created this
      * {@code CryptoCipher} object..
+     * </p>
      *
      * @return the algorithm name of this {@code CryptoCipher} object.
      */
@@ -203,6 +205,7 @@ class JceCipher implements CryptoCipher {
      * either GCM or CCM 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
      *
@@ -230,6 +233,7 @@ class JceCipher implements CryptoCipher {
      * either GCM or CCM 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
      *
diff --git a/src/main/java/org/apache/commons/crypto/cipher/OpenSslCipher.java b/src/main/java/org/apache/commons/crypto/cipher/OpenSslCipher.java
index 50e73da..e829ed3 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/OpenSslCipher.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/OpenSslCipher.java
@@ -76,9 +76,11 @@ class OpenSslCipher implements CryptoCipher {
     /**
      * Returns the algorithm name of this {@code CryptoCipher} object.
      *
-     * <p>This is the same name that was specified in one of the
+     * <p>
+     * This is the same name that was specified in one of the
      * {@code CryptoCipherFactory#getInstance} calls that created this
      * {@code CryptoCipher} object..
+     * </p>
      *
      * @return the algorithm name of this {@code CryptoCipher} object.
      */
@@ -210,6 +212,7 @@ class OpenSslCipher implements CryptoCipher {
      * either 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
      *
@@ -248,6 +251,7 @@ class OpenSslCipher implements CryptoCipher {
      * either 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] 01/02: 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 d71387101719286d610da055234915fb13617d82
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Dec 12 07:53:52 2022 -0500

    Format and Javadoc
---
 .../commons/crypto/cipher/OpenSslCommonMode.java   | 67 +++++++++-------------
 1 file changed, 28 insertions(+), 39 deletions(-)

diff --git a/src/main/java/org/apache/commons/crypto/cipher/OpenSslCommonMode.java b/src/main/java/org/apache/commons/crypto/cipher/OpenSslCommonMode.java
index dea4412..7641846 100644
--- a/src/main/java/org/apache/commons/crypto/cipher/OpenSslCommonMode.java
+++ b/src/main/java/org/apache/commons/crypto/cipher/OpenSslCommonMode.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.cipher;
 
 import java.nio.ByteBuffer;
@@ -30,6 +30,7 @@ import javax.crypto.spec.IvParameterSpec;
  * This class do the real work(Encryption/Decryption) for non-authenticated modes, such as CTR, CBC.
  * <p>
  * It will call the OpenSSL API to implement encryption/decryption
+ * </p>
  */
 class OpenSslCommonMode extends AbstractOpenSslFeedbackCipher {
 
@@ -38,8 +39,7 @@ class OpenSslCommonMode extends AbstractOpenSslFeedbackCipher {
     }
 
     @Override
-    public void init(final int mode, final byte[] key, final AlgorithmParameterSpec params)
-            throws InvalidAlgorithmParameterException {
+    public void init(final int mode, final byte[] key, final AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException {
         this.cipherMode = mode;
         final byte[] iv;
         if (!(params instanceof IvParameterSpec)) {
@@ -54,9 +54,7 @@ class OpenSslCommonMode extends AbstractOpenSslFeedbackCipher {
     public int update(final ByteBuffer input, final ByteBuffer output) throws ShortBufferException {
         checkState();
 
-        final int len = OpenSslNative.update(context, input, input.position(),
-                input.remaining(), output, output.position(),
-                output.remaining());
+        final int len = OpenSslNative.update(context, input, input.position(), input.remaining(), output, output.position(), output.remaining());
         input.position(input.limit());
         output.position(output.position() + len);
 
@@ -64,12 +62,10 @@ class OpenSslCommonMode extends AbstractOpenSslFeedbackCipher {
     }
 
     @Override
-    public int update(final byte[] input, final int inputOffset, final int inputLen, final byte[] output, final int outputOffset)
-            throws ShortBufferException {
+    public int update(final byte[] input, final int inputOffset, final int inputLen, final byte[] output, final int outputOffset) throws ShortBufferException {
         checkState();
 
-        return OpenSslNative.updateByteArray(context, input, inputOffset,
-                inputLen, output, outputOffset, output.length - outputOffset);
+        return OpenSslNative.updateByteArray(context, input, inputOffset, inputLen, output, outputOffset, output.length - outputOffset);
     }
 
     @Override
@@ -78,30 +74,25 @@ class OpenSslCommonMode extends AbstractOpenSslFeedbackCipher {
         checkState();
         final int outputLength = output.length;
 
-        int len = OpenSslNative.updateByteArray(context, input, inputOffset,
-                inputLen, output, outputOffset, outputLength - outputOffset);
+        int len = OpenSslNative.updateByteArray(context, input, inputOffset, inputLen, output, outputOffset, outputLength - outputOffset);
 
-        len += OpenSslNative.doFinalByteArray(context, output, outputOffset + len,
-                outputLength - outputOffset - len);
+        len += OpenSslNative.doFinalByteArray(context, output, outputOffset + len, outputLength - outputOffset - len);
 
         return len;
     }
 
     @Override
-    public int doFinal(final ByteBuffer input, final ByteBuffer output)
-            throws ShortBufferException, IllegalBlockSizeException, BadPaddingException {
+    public int doFinal(final ByteBuffer input, final ByteBuffer output) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException {
         checkState();
 
         int totalLen = 0;
-        int len = OpenSslNative.update(context, input, input.position(),
-                input.remaining(), output, output.position(), output.remaining());
+        int len = OpenSslNative.update(context, input, input.position(), input.remaining(), output, output.position(), output.remaining());
         totalLen += len;
 
         input.position(input.limit());
         output.position(output.position() + len);
 
-        len = OpenSslNative.doFinal(context, output, output.position(),
-                output.remaining());
+        len = OpenSslNative.doFinal(context, output, output.position(), output.remaining());
         totalLen += len;
 
         output.position(output.position() + len);
@@ -111,8 +102,6 @@ class OpenSslCommonMode extends AbstractOpenSslFeedbackCipher {
 
     @Override
     public void updateAAD(final byte[] aad) {
-        throw new UnsupportedOperationException(
-                "The underlying Cipher implementation "
-                        + "does not support this method");
+        throw new UnsupportedOperationException("The underlying Cipher implementation does not support this method");
     }
 }