[java-oidc-common] branch main updated: JCOMOIDC-61 - A128CBC-HS256 Potentially returning the wrong keysize

Phil Smart philip.smart at jisc.ac.uk
Mon Jan 23 11:18:46 UTC 2023


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=549029d5178da2f2f6203cf679c3c268e8c54db9

The following commit(s) were added to refs/heads/main by this push:
     new 549029d  JCOMOIDC-61 - A128CBC-HS256 Potentially returning the wrong keysize
549029d is described below

commit 549029d5178da2f2f6203cf679c3c268e8c54db9
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Jan 23 11:18:39 2023 +0000

    JCOMOIDC-61 - A128CBC-HS256 Potentially returning the wrong keysize
    
     - Update keysize for symmetric key algs
    
    https://shibboleth.atlassian.net/browse/JCOMOIDC-61
---
 .../oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256.java   | 9 ++++++++-
 .../oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384.java   | 9 ++++++++-
 .../oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512.java   | 9 ++++++++-
 .../jwa/algorithm/descriptors/EncryptionA128CBCHS256Test.java    | 4 ++--
 .../jwa/algorithm/descriptors/EncryptionA192CBCHS384Test.java    | 2 +-
 .../jwa/algorithm/descriptors/EncryptionA256CBCHS512Test.java    | 9 +++++----
 6 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256.java b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256.java
index 0efff6f..a82af95 100644
--- a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256.java
+++ b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256.java
@@ -31,42 +31,49 @@ import net.shibboleth.oidc.jwa.support.JCAConstantExtension;
 public final class EncryptionA128CBCHS256 implements BlockEncryptionAlgorithm {
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getKey() {
         return JCAConstants.KEY_ALGO_AES;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getURI() {
         return EncryptionConstants.ALGO_ID_ENC_ALG_A128CBC_HS256;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public AlgorithmType getType() {
         return AlgorithmType.BlockEncryption;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getJCAAlgorithmID() {
         return String.format("%s/%s/%s", getKey(), getCipherMode(), getPadding());
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public Integer getKeyLength() {
-        return 128;
+        return 256;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getCipherMode() {
         return JCAConstants.CIPHER_MODE_CBC;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getPadding() {
         return JCAConstantExtension.CIPHER_PADDING_PKCS5;
diff --git a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384.java b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384.java
index 5eaeed8..de7cd9f 100644
--- a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384.java
+++ b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384.java
@@ -31,42 +31,49 @@ import net.shibboleth.oidc.jwa.support.JCAConstantExtension;
 public final class EncryptionA192CBCHS384 implements BlockEncryptionAlgorithm {
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getKey() {
         return JCAConstants.KEY_ALGO_AES;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getURI() {
         return EncryptionConstants.ALGO_ID_ENC_ALG_A192CBC_HS384;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public AlgorithmType getType() {
         return AlgorithmType.BlockEncryption;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getJCAAlgorithmID() {
         return String.format("%s/%s/%s", getKey(), getCipherMode(), getPadding());
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public Integer getKeyLength() {
-        return 192;
+        return 384;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getCipherMode() {
         return JCAConstants.CIPHER_MODE_CBC;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getPadding() {
         return JCAConstantExtension.CIPHER_PADDING_PKCS5;
diff --git a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512.java b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512.java
index edcd401..f83d6ae 100644
--- a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512.java
+++ b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512.java
@@ -31,42 +31,49 @@ import net.shibboleth.oidc.jwa.support.JCAConstantExtension;
 public final class EncryptionA256CBCHS512 implements BlockEncryptionAlgorithm {
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getKey() {
         return JCAConstants.KEY_ALGO_AES;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getURI() {
         return EncryptionConstants.ALGO_ID_ENC_ALG_A256CBC_HS512;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public AlgorithmType getType() {
         return AlgorithmType.BlockEncryption;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getJCAAlgorithmID() {
         return String.format("%s/%s/%s", getKey(), getCipherMode(), getPadding());
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public Integer getKeyLength() {
-        return 256;
+        return 512;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getCipherMode() {
         return JCAConstants.CIPHER_MODE_CBC;
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull
     public String getPadding() {
         return JCAConstantExtension.CIPHER_PADDING_PKCS5;
diff --git a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256Test.java b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256Test.java
index b6556fd..c979ef0 100644
--- a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256Test.java
+++ b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA128CBCHS256Test.java
@@ -30,7 +30,7 @@ import net.shibboleth.oidc.jwa.support.JCAConstantExtension;
  */
 public class EncryptionA128CBCHS256Test {
 
-	private EncryptionA128CBCHS256 algorithm = new EncryptionA128CBCHS256();
+	private final EncryptionA128CBCHS256 algorithm = new EncryptionA128CBCHS256();
 
 	@Test
 	public void testInitialState() {
@@ -38,7 +38,7 @@ public class EncryptionA128CBCHS256Test {
 		Assert.assertEquals(EncryptionConstants.ALGO_ID_ENC_ALG_A128CBC_HS256, algorithm.getURI());
 		Assert.assertEquals(AlgorithmType.BlockEncryption, algorithm.getType());
 		Assert.assertEquals("AES/CBC/PKCS5Padding", algorithm.getJCAAlgorithmID());
-		Assert.assertEquals(Integer.valueOf(128), algorithm.getKeyLength());
+		Assert.assertEquals(Integer.valueOf(256), algorithm.getKeyLength());
 		Assert.assertEquals(JCAConstants.CIPHER_MODE_CBC, algorithm.getCipherMode());
 		Assert.assertEquals(JCAConstantExtension.CIPHER_PADDING_PKCS5, algorithm.getPadding());
 	}
diff --git a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384Test.java b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384Test.java
index 085417e..cab1b0a 100644
--- a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384Test.java
+++ b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA192CBCHS384Test.java
@@ -37,7 +37,7 @@ public class EncryptionA192CBCHS384Test {
 		Assert.assertEquals(EncryptionConstants.ALGO_ID_ENC_ALG_A192CBC_HS384, algorithm.getURI());
 		Assert.assertEquals(AlgorithmType.BlockEncryption, algorithm.getType());
 		Assert.assertEquals("AES/CBC/PKCS5Padding", algorithm.getJCAAlgorithmID());
-		Assert.assertEquals(Integer.valueOf(192), algorithm.getKeyLength());
+		Assert.assertEquals(Integer.valueOf(384), algorithm.getKeyLength());
 		Assert.assertEquals(JCAConstants.CIPHER_MODE_CBC, algorithm.getCipherMode());
 		Assert.assertEquals(JCAConstantExtension.CIPHER_PADDING_PKCS5, algorithm.getPadding());
 	}
diff --git a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512Test.java b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512Test.java
index 023daa6..3e2688a 100644
--- a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512Test.java
+++ b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/EncryptionA256CBCHS512Test.java
@@ -17,19 +17,20 @@
 
 package net.shibboleth.oidc.jwa.algorithm.descriptors;
 
-import net.shibboleth.oidc.jwa.support.EncryptionConstants;
-import net.shibboleth.oidc.jwa.support.JCAConstantExtension;
 import org.opensaml.security.crypto.JCAConstants;
 import org.opensaml.xmlsec.algorithm.AlgorithmDescriptor.AlgorithmType;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import net.shibboleth.oidc.jwa.support.EncryptionConstants;
+import net.shibboleth.oidc.jwa.support.JCAConstantExtension;
+
 /**
  * Unit tests for {@link EncryptionA256CBCHS512}
  */
 public class EncryptionA256CBCHS512Test {
 
-	private EncryptionA256CBCHS512 algorithm = new EncryptionA256CBCHS512();
+	private final EncryptionA256CBCHS512 algorithm = new EncryptionA256CBCHS512();
 
 	@Test
 	public void testInitialState() {
@@ -37,7 +38,7 @@ public class EncryptionA256CBCHS512Test {
 		Assert.assertEquals(EncryptionConstants.ALGO_ID_ENC_ALG_A256CBC_HS512, algorithm.getURI());
 		Assert.assertEquals(AlgorithmType.BlockEncryption, algorithm.getType());
 		Assert.assertEquals("AES/CBC/PKCS5Padding", algorithm.getJCAAlgorithmID());
-		Assert.assertEquals(Integer.valueOf(256), algorithm.getKeyLength());
+		Assert.assertEquals(Integer.valueOf(512), algorithm.getKeyLength());
 		Assert.assertEquals(JCAConstants.CIPHER_MODE_CBC, algorithm.getCipherMode());
 		Assert.assertEquals(JCAConstantExtension.CIPHER_PADDING_PKCS5, algorithm.getPadding());
 	}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list