[java-oidc-common] branch dev/JCOMOIDC-41 updated: JOIDCRP-17 - Add JWT Encryption Parameter Resolver Support

Phil Smart philip.smart at jisc.ac.uk
Mon Aug 15 08:20:35 UTC 2022


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

philsmart pushed a commit to branch dev/JCOMOIDC-41
in repository java-oidc-common.

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

The following commit(s) were added to refs/heads/dev/JCOMOIDC-41 by this push:
     new 1746364  JOIDCRP-17 - Add JWT Encryption Parameter Resolver Support
1746364 is described below

commit 1746364776c7c327d5906ecb85d00da4aede3068
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Aug 15 09:20:27 2022 +0100

    JOIDCRP-17 - Add JWT Encryption Parameter Resolver Support
    
     - Fix ECDH-ED algorithm descriptor
    
    https://shibboleth.atlassian.net/browse/JOIDCRP-17
---
 .../algorithm/descriptors/KeyAgreementECDHES.java  | 43 +++-------------------
 .../descriptors/KeyAgreementECDHESTest.java        | 11 ++----
 2 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHES.java b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHES.java
index 354b786..916da74 100644
--- a/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHES.java
+++ b/oidc-common-crypto-api/src/main/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHES.java
@@ -25,61 +25,28 @@ import org.opensaml.xmlsec.algorithm.KeyAgreementAlgorithm;
 import net.shibboleth.oidc.jwa.support.KeyManagementConstants;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
-/**
- * Algorithm descriptor for JWE key management algorithm: ECDH-ES.
- * 
- */
+/** Algorithm descriptor for JWE key management algorithm: ECDH-ES. */
 public class KeyAgreementECDHES implements KeyAgreementAlgorithm {
 
-    /**
-     * Get the key algorithm.
-     * @return The key algorithm.
-     */
-    @Nonnull
-    @NotEmpty
-    public String getKey() {
-        return JCAConstants.KEY_ALGO_EC;
-    }
-
-    /** {@inheritDoc} */
+    @Override
     @Nonnull
     @NotEmpty
     public String getURI() {
         return KeyManagementConstants.ALGO_ID_ALG_ECDH_ES;
     }
 
-    /** {@inheritDoc} */
+    @Override
     @Nonnull
     public AlgorithmType getType() {
         return AlgorithmType.KeyAgreement;
     }
 
-    /** {@inheritDoc} */
+    @Override
     @Nonnull
     @NotEmpty
     public String getJCAAlgorithmID() {
-        return String.format("%s/%s/%s", getKey(), getCipherMode(), getPadding());
-    }
-
-    /**
-     * Get the cipher mode.
-     * @return The cipher mode.
-     */
-    @Nonnull
-    @NotEmpty
-    public String getCipherMode() {
-        return JCAConstants.CIPHER_MODE_ECB;
+        return JCAConstants.KEY_AGREEMENT_ECDH;
     }
 
-    /**
-     * Get the cipher padding.
-     * @return The cipher padding.
-     */
-    @Nonnull
-    @NotEmpty
-    public String getPadding() {
-        //TODO: Verify padding scheme value
-        return JCAConstants.CIPHER_PADDING_PKCS1;
-    }
 
 }
diff --git a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHESTest.java b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHESTest.java
index 467f74f..9f8e72a 100644
--- a/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHESTest.java
+++ b/oidc-common-crypto-api/src/test/java/net/shibboleth/oidc/jwa/algorithm/descriptors/KeyAgreementECDHESTest.java
@@ -17,10 +17,8 @@
 
 package net.shibboleth.oidc.jwa.algorithm.descriptors;
 
-import org.testng.Assert;
-
-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.KeyManagementConstants;
@@ -30,16 +28,13 @@ import net.shibboleth.oidc.jwa.support.KeyManagementConstants;
  */
 public class KeyAgreementECDHESTest {
 
-	private KeyAgreementECDHES algorithm = new KeyAgreementECDHES();
+	private final KeyAgreementECDHES algorithm = new KeyAgreementECDHES();
 
 	@Test
 	public void testInitialState() {
-		Assert.assertEquals(JCAConstants.KEY_ALGO_EC, algorithm.getKey());
 		Assert.assertEquals(KeyManagementConstants.ALGO_ID_ALG_ECDH_ES, algorithm.getURI());
 		Assert.assertEquals(AlgorithmType.KeyAgreement, algorithm.getType());
-		Assert.assertEquals("EC/ECB/PKCS1Padding", algorithm.getJCAAlgorithmID());
-		Assert.assertEquals(JCAConstants.CIPHER_MODE_ECB, algorithm.getCipherMode());
-		Assert.assertEquals(JCAConstants.CIPHER_PADDING_PKCS1, algorithm.getPadding());
+		Assert.assertEquals("ECDH", algorithm.getJCAAlgorithmID());
 	}
 
 }
\ No newline at end of file

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


More information about the commits mailing list