changeset 58823:d8c6441b3a33

8231415: Better signatures in XML Reviewed-by: weijun, mschoene, rhalade
author mullan
date Tue, 15 Oct 2019 08:18:48 -0400
parents d5b6b9733f13
children e750389b51b9
files src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java	Mon Apr 06 15:40:16 2020 -0700
+++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java	Tue Oct 15 08:18:48 2019 -0400
@@ -170,9 +170,15 @@
                 "support DOM Level 2 and be namespace aware");
         }
         if ("KeyInfo".equals(tag) && XMLSignature.XMLNS.equals(namespace)) {
-            return new DOMKeyInfo(element, new UnmarshalContext(), getProvider());
+            try {
+                return new DOMKeyInfo(element, new UnmarshalContext(), getProvider());
+            } catch (MarshalException me) {
+                throw me;
+            } catch (Exception e) {
+                throw new MarshalException(e);
+            }
         } else {
-            throw new MarshalException("invalid KeyInfo tag: " + namespace + ":" + tag);
+            throw new MarshalException("Invalid KeyInfo tag: " + namespace + ":" + tag);
         }
     }
 
--- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Mon Apr 06 15:40:16 2020 -0700
+++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Tue Oct 15 08:18:48 2019 -0400
@@ -192,9 +192,15 @@
                 "support DOM Level 2 and be namespace aware");
         }
         if ("Signature".equals(tag) && XMLSignature.XMLNS.equals(namespace)) {
-            return new DOMXMLSignature(element, context, getProvider());
+            try {
+                return new DOMXMLSignature(element, context, getProvider());
+            } catch (MarshalException me) {
+                throw me;
+            } catch (Exception e) {
+                throw new MarshalException(e);
+            }
         } else {
-            throw new MarshalException("invalid Signature tag: " + namespace + ":" + tag);
+            throw new MarshalException("Invalid Signature tag: " + namespace + ":" + tag);
         }
     }