[java-opensaml] 03/04: OSJ-245: Uncaught exception handling invalid certificates during ...

Brent Putman putmanb at georgetown.edu
Tue Sep 11 21:38:40 EDT 2018


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

putmanb pushed a commit to branch master
in repository java-opensaml.

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

commit d536a2bdc75d149c6fd7fa0402333181b4249449
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Tue Sep 11 19:18:45 2018 -0400

    OSJ-245: Uncaught exception handling invalid certificates during ...
---
 .../java/org/opensaml/security/x509/X509Support.java    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java b/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java
index 4dfee1f..49662f1 100644
--- a/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java
+++ b/opensaml-security-api/src/main/java/org/opensaml/security/x509/X509Support.java
@@ -197,13 +197,20 @@ public class X509Support {
         for (int i = 0; i < nameTypes.length; i++) {
             types[i]= GeneralNameType.fromTagNumber(nameTypes[i]);
         }
-        final GeneralNames names = CertUtil.subjectAltNames(certificate, types);
-        if (names != null) {
-            for (final GeneralName name : names.getNames()) {
-                altNames.add(convertAltNameType(name.getTagNo(), name.getName().toASN1Primitive()));
+        
+        try {
+            final GeneralNames names = CertUtil.subjectAltNames(certificate, types);
+            if (names != null) {
+                for (final GeneralName name : names.getNames()) {
+                    altNames.add(convertAltNameType(name.getTagNo(), name.getName().toASN1Primitive()));
+                }
             }
+            return altNames;
+        } catch (EncodingException e) {
+            final Logger log = getLogger();
+            log.warn("Could not extract alt names from certificate", e);
+            throw e;
         }
-        return altNames;
     }
 
     /**

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


More information about the commits mailing list