8231415: Better signatures in XML

Reviewed-by: weijun, mschoene, rhalade
This commit is contained in:
Sean Mullan 2019-10-15 08:18:48 -04:00
parent 25642dd303
commit 9efd3d7f20
2 changed files with 16 additions and 4 deletions

View File

@ -170,9 +170,15 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
"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);
}
}

View File

@ -192,9 +192,15 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
"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);
}
}