[java-opensaml] branch main updated: Check for null credential before passing into extraction API.

Scott Cantor cantor.2 at osu.edu
Fri Mar 31 15:41:30 UTC 2023


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

scantor pushed a commit to branch main
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=c2a96fb5ba81444563ad8d54e3b869f53b3b0382

The following commit(s) were added to refs/heads/main by this push:
     new c2a96fb5b Check for null credential before passing into extraction API.
c2a96fb5b is described below

commit c2a96fb5ba81444563ad8d54e3b869f53b3b0382
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Mar 31 11:39:32 2023 -0400

    Check for null credential before passing into extraction API.
---
 .../src/main/java/org/opensaml/saml/saml2/encryption/Encrypter.java  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Encrypter.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Encrypter.java
index 9b22640f1..3e67561aa 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Encrypter.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/encryption/Encrypter.java
@@ -46,6 +46,7 @@ import org.opensaml.saml.saml2.core.NameID;
 import org.opensaml.saml.saml2.core.NewEncryptedID;
 import org.opensaml.saml.saml2.core.NewID;
 import org.opensaml.security.SecurityException;
+import org.opensaml.security.credential.Credential;
 import org.opensaml.security.credential.CredentialSupport;
 import org.opensaml.xmlsec.encryption.CarriedKeyName;
 import org.opensaml.xmlsec.encryption.DataReference;
@@ -367,7 +368,9 @@ public class Encrypter extends org.opensaml.xmlsec.encryption.support.Encrypter
         final String encryptionAlgorithmURI = encParams.getAlgorithm();
         // Checked above.
         assert encryptionAlgorithmURI != null;
-        Key encryptionKey = CredentialSupport.extractEncryptionKey(encParams.getEncryptionCredential());
+        
+        final Credential encryptionCred = encParams.getEncryptionCredential();
+        Key encryptionKey = encryptionCred != null ? CredentialSupport.extractEncryptionKey(encryptionCred) : null;
         if (encryptionKey == null) {
             encryptionKey = generateEncryptionKey(encryptionAlgorithmURI);
         }

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


More information about the commits mailing list