[java-opensaml] branch master updated: IDP-1281, OSJ-245 capture EncodingException from cryptacular

Rod Widdowson rdw at steadingsoftware.com
Sun Jul 1 10:31:24 EDT 2018


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

rdw 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=a7b45e2cb9eacbf2e5f50f8cf87ae48a03e983eb

The following commit(s) were added to refs/heads/master by this push:
       new  a7b45e2   IDP-1281, OSJ-245 capture EncodingException from cryptacular
a7b45e2 is described below

commit a7b45e2cb9eacbf2e5f50f8cf87ae48a03e983eb
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Jul 1 15:28:30 2018 +0100

    IDP-1281, OSJ-245 capture EncodingException from cryptacular
    
    https://issues.shibboleth.net/jira/browse/IDP-1281
    https://issues.shibboleth.net/jira/browse/OSJ-245
    
    ....and turn it into something the rest of the stack can understand.
---
 .../src/main/java/org/opensaml/security/x509/X509Support.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 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 91f4b40..4dfee1f 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
@@ -53,6 +53,7 @@ import org.bouncycastle.asn1.DEROctetString;
 import org.bouncycastle.asn1.x509.GeneralName;
 import org.bouncycastle.asn1.x509.GeneralNames;
 import org.bouncycastle.x509.extension.X509ExtensionUtil;
+import org.cryptacular.EncodingException;
 import org.cryptacular.util.CertUtil;
 import org.cryptacular.util.CodecUtil;
 import org.cryptacular.x509.GeneralNameType;
@@ -338,7 +339,11 @@ public class X509Support {
      */
     @Nullable public static Collection<X509Certificate> decodeCertificates(@Nonnull final byte[] certs)
             throws CertificateException {
-        return Arrays.asList(CertUtil.decodeCertificateChain(certs));
+        try {
+            return Arrays.asList(CertUtil.decodeCertificateChain(certs));
+        } catch (final EncodingException e) {
+            throw new CertificateException("Error deocding certificates", e);
+        }
     }
     
     /**
@@ -379,7 +384,7 @@ public class X509Support {
     @Nullable public static X509Certificate decodeCertificate(@Nonnull final byte[] cert) throws CertificateException {
         try {
             return CertUtil.decodeCertificate(cert);
-        } catch (final IllegalArgumentException e) {
+        } catch (final IllegalArgumentException | EncodingException e) {
             throw new CertificateException(e);
         }
     }

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


More information about the commits mailing list