[java-opensaml] branch main updated: Fix array casting issue on previous commit.

Brent Putman putmanb at georgetown.edu
Thu Sep 3 03:35:13 UTC 2020


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

putmanb 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=575392d0e6b3ba09aff86679bb27aec98f278320

The following commit(s) were added to refs/heads/main by this push:
       new  575392d0e Fix array casting issue on previous commit.
575392d0e is described below

commit 575392d0e6b3ba09aff86679bb27aec98f278320
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Wed Sep 2 23:35:11 2020 -0400

    Fix array casting issue on previous commit.
---
 .../tls/impl/ThreadLocalX509TrustEngineSupport.java   | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/opensaml-security-impl/src/main/java/org/opensaml/security/x509/tls/impl/ThreadLocalX509TrustEngineSupport.java b/opensaml-security-impl/src/main/java/org/opensaml/security/x509/tls/impl/ThreadLocalX509TrustEngineSupport.java
index b07894cee..45620713f 100644
--- a/opensaml-security-impl/src/main/java/org/opensaml/security/x509/tls/impl/ThreadLocalX509TrustEngineSupport.java
+++ b/opensaml-security-impl/src/main/java/org/opensaml/security/x509/tls/impl/ThreadLocalX509TrustEngineSupport.java
@@ -63,15 +63,18 @@ public final class ThreadLocalX509TrustEngineSupport {
             throw new IllegalArgumentException("Certificate chain was null or empty");
         }
         
-        // Just sanity checking this
-        if (X509Certificate.class.isInstance(chain[0])) {
-            try {
-                evaluate((X509Certificate[]) chain);
-            } catch (final CertificateException e) {
-                throw new SSLPeerUnverifiedException(e.getMessage());
+        final X509Certificate[] x509Chain = new X509Certificate[chain.length];
+        for (int i=0; i<chain.length; i++) {
+            if (!X509Certificate.class.isInstance(chain[i])) {
+                throw new SSLPeerUnverifiedException("Certificate chain contained non-X509Certificate");
             }
-        } else {
-            throw new SSLPeerUnverifiedException("Certificate chain was not instance of X509Certificate");
+            x509Chain[i] = (X509Certificate) chain[i];
+        }
+
+        try {
+            evaluate(x509Chain);
+        } catch (final CertificateException e) {
+            throw new SSLPeerUnverifiedException(e.getMessage());
         }
     }
 

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


More information about the commits mailing list