[java-oidc-common] branch main updated: Add additional encryption test for unsupported alg

Phil Smart philip.smart at jisc.ac.uk
Mon Jan 9 15:23:29 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=a1e2837df259fc799ef8a8341c3c00a4aa8c8d25

The following commit(s) were added to refs/heads/main by this push:
     new a1e2837  Add additional encryption test for unsupported alg
a1e2837 is described below

commit a1e2837df259fc799ef8a8341c3c00a4aa8c8d25
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Jan 9 15:23:27 2023 +0000

    Add additional encryption test for unsupported alg
---
 .../oidc/security/impl/EncryptJWTHandlerTest.java   | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/oidc-common-crypto-impl/src/test/java/net/shibboleth/oidc/security/impl/EncryptJWTHandlerTest.java b/oidc-common-crypto-impl/src/test/java/net/shibboleth/oidc/security/impl/EncryptJWTHandlerTest.java
index 23f54ca..a493ed2 100644
--- a/oidc-common-crypto-impl/src/test/java/net/shibboleth/oidc/security/impl/EncryptJWTHandlerTest.java
+++ b/oidc-common-crypto-impl/src/test/java/net/shibboleth/oidc/security/impl/EncryptJWTHandlerTest.java
@@ -303,6 +303,27 @@ public class EncryptJWTHandlerTest extends AbstractHandlerTest {
 
     }
     
+  @Test(expectedExceptions = MessageHandlerException.class)
+  public void testEncryptWithUnsupportedAlgorithm() throws Exception {
+      
+      final JWTSecurityParametersContext secParamCtx = new JWTSecurityParametersContext();
+      final var params = new JWTEncryptionParameters();
+      params.setKeyTransportEncryptionAlgorithm("NotSupported");
+      params.setDataEncryptionAlgorithm(EncryptionConstants.ALGO_ID_ENC_ALG_A128GCM);
+      final RSAKey key = new RSAKeyGenerator(2048)
+              .algorithm(JWEAlgorithm.RSA_OAEP_256)
+              .keyUse(KeyUse.ENCRYPTION)
+              .keyID("mock-key")
+              .generate();
+      params.setKeyTransportEncryptionCredential(TestCredentialHelper.createKeyEncryptionCredential(key));
+      
+      secParamCtx.setEncryptionParameters(params);  
+      prc.getOutboundMessageContext().addSubcontext(secParamCtx);
+      
+      encrypter.initialize();        
+      encrypter.invoke(prc.getOutboundMessageContext());
+  }
+    
 
 
 }

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


More information about the commits mailing list