From 0290284cad12912e15dc3b980957695d3e4cc166 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Fri, 3 Sep 2021 10:43:21 +0200
Subject: add jUnit test that uses RSASSA-PSS algorithm

---
 .../sl20/utils/AbstractJsonSecurityUtilsTest.java  | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'eaaf_modules/eaaf_module_auth_sl20/src/test/java')

diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/AbstractJsonSecurityUtilsTest.java b/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/AbstractJsonSecurityUtilsTest.java
index cfa8868e..89e4b326 100644
--- a/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/AbstractJsonSecurityUtilsTest.java
+++ b/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/AbstractJsonSecurityUtilsTest.java
@@ -315,6 +315,33 @@ public abstract class AbstractJsonSecurityUtilsTest {
 
   }
 
+  @Test
+  public void validSigningRsaPss() throws CertificateEncodingException, KeyStoreException,
+      JoseException, IOException, EaafException {
+    
+    // 
+    config.putConfigValue("modules.sl20.security.sigalg.rsa", "PS256");
+    
+    setRsaSigningKey();
+    setRsaEncryptionKey();
+
+    final String payLoad = "{\"aac\":\"" + RandomStringUtils.randomAlphanumeric(100) + "\"}";
+
+    final String jws = joseTools.createSignature(payLoad);
+    Assert.assertNotNull("Signed msg", jws);
+
+    final VerificationResult verify = joseTools.validateSignature(
+        jws,
+        keyStoreFactory.buildNewKeyStore(getSigTrustStoreConfigValid()).getFirst(),
+        getDefaultAlgorithmConstrains());
+    Assert.assertTrue("wrong verify state", verify.isValidSigned());
+    Assert.assertNotNull("JWS Header", verify.getJoseHeader());
+    Assert.assertNotNull("JWS Payload", verify.getPayload());
+    Assert.assertNotNull("CertChain", verify.getCertChain());
+
+
+  }
+  
   @Test
   public void validSigningEc() throws CertificateEncodingException, KeyStoreException,
       JoseException, IOException, EaafException {
-- 
cgit v1.2.3