diff --git a/jdk/test/javax/xml/crypto/dsig/ValidationTests.java b/jdk/test/javax/xml/crypto/dsig/ValidationTests.java
index 3480f23b2be..d7384815f44 100644
--- a/jdk/test/javax/xml/crypto/dsig/ValidationTests.java
+++ b/jdk/test/javax/xml/crypto/dsig/ValidationTests.java
@@ -35,6 +35,7 @@ import java.io.FileInputStream;
import java.security.*;
import javax.xml.crypto.Data;
import javax.xml.crypto.KeySelector;
+import javax.xml.crypto.MarshalException;
import javax.xml.crypto.OctetStreamData;
import javax.xml.crypto.URIDereferencer;
import javax.xml.crypto.URIReference;
@@ -60,9 +61,17 @@ public class ValidationTests {
static class Test {
String file;
KeySelector ks;
- Test(String file, KeySelector ks) {
+ Class exception;
+
+ Test(String file, KeySelector ks, Class exception) {
this.file = file;
this.ks = ks;
+ this.exception = exception;
+ }
+
+ // XMLSignatureException is expected by default
+ Test(String file, KeySelector ks) {
+ this(file, ks, XMLSignatureException.class);
}
}
@@ -110,7 +119,17 @@ public class ValidationTests {
private final static Test[] INVALID_TESTS = {
new Test("signature-enveloping-hmac-sha1-40.xml", SKKS),
new Test("signature-enveloping-hmac-sha1-trunclen-0-attack.xml", SKKS),
- new Test("signature-enveloping-hmac-sha1-trunclen-8-attack.xml", SKKS)
+ new Test("signature-enveloping-hmac-sha1-trunclen-8-attack.xml", SKKS),
+ new Test("signature-extra-text-in-signed-info.xml", SKKS,
+ MarshalException.class),
+ new Test("signature-wrong-canonicalization-method-algorithm.xml", SKKS,
+ MarshalException.class),
+ new Test("signature-wrong-transform-algorithm.xml", SKKS,
+ MarshalException.class),
+ new Test("signature-no-reference-uri.xml", SKKS),
+ new Test("signature-wrong-signature-method-algorithm.xml", SKKS,
+ MarshalException.class),
+ new Test("signature-wrong-tag-names.xml", SKKS, MarshalException.class)
};
public static void main(String args[]) throws Exception {
@@ -143,9 +162,14 @@ public class ValidationTests {
test_signature(test);
System.out.println("FAILED");
atLeastOneFailed = true;
- } catch (XMLSignatureException xse) {
- System.out.println(xse.getMessage());
- System.out.println("PASSED");
+ } catch (Exception e) {
+ System.out.println("Exception: " + e);
+ if (e.getClass() != test.exception) {
+ System.out.println("FAILED: unexpected exception");
+ atLeastOneFailed = true;
+ } else {
+ System.out.println("PASSED");
+ }
}
}
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-extra-text-in-signed-info.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-extra-text-in-signed-info.xml
new file mode 100644
index 00000000000..578e7bb16e9
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-extra-text-in-signed-info.xml
@@ -0,0 +1,3 @@
+test1Bq8FsjajUBYPD7stQeJSc66GlM=extra textiTrgJERmYeD5hFwY8/MwJpkF+nd++AAOgf/Kxt9SwdE6BIYq2Vyxq4CQPhD+t2971BGTgvF6ejZd
++/Ko4Zs5Dqf4Lt65Vck0q43rM0PdP1e8gJov0IPYnZ1zeqFpah+N/OjmqTbshaZWRIjf3eqS6en5
+ZKjn+TkCQ1kOX/YUNDc=
\ No newline at end of file
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-no-reference-uri.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-no-reference-uri.xml
new file mode 100644
index 00000000000..eb199f79df2
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-no-reference-uri.xml
@@ -0,0 +1,3 @@
+test1Bq8FsjajUBYPD7stQeJSc66GlM=BNPSYlNcyXcO/Tc1tr9mQ/KAZ40eFybLTDyB/HH1EHHMpc972A+nOX2EWBaLsVgG8apl0Isp1ZqV
+gmoDHNF6xrcJJQVydVJzU08GVV4GiXHMqRYQbted7STQLhlhssvNNdMEoVApsX5ByL66wxKZQXrT
+z1kZtOHAi88DOrmIJu0=
\ No newline at end of file
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-canonicalization-method-algorithm.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-canonicalization-method-algorithm.xml
new file mode 100644
index 00000000000..2ce430e1de9
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-canonicalization-method-algorithm.xml
@@ -0,0 +1,3 @@
+test1Bq8FsjajUBYPD7stQeJSc66GlM=EBbyEV7e+1CTUsyCTyxiN8p+U3/za1oTjK7q+kF8Q87r8e/7C1z4ndGWbk6zyI3w6leT+I2suW9U
+KkdvkrDXX2OyLw0GfgJfLkNn+1pGK6kyWpL95NoWJZhHkUAKKBZ0ikfZ4j33gYxrYK+IYCLeZYzr
+hlZjdXXXCiSH0Sq+weQ=
\ No newline at end of file
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-signature-method-algorithm.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-signature-method-algorithm.xml
new file mode 100644
index 00000000000..a2709caec76
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-signature-method-algorithm.xml
@@ -0,0 +1,3 @@
+test1Bq8FsjajUBYPD7stQeJSc66GlM=RjL9nfQg9u6+KEFfAlBBH7E7ilFgB7YEQ5MxOIJN/fOdQmc5iDD+YuhiHzNGXGi/UOyo6t8LxTxl
+X4oFE1RNlPVkSAZK4LcTWhVa757WwgW1/EZo8PQYWp5NScLq6PumYaujoovSYBKW2N6+jQpnD/L6
+4cuEVNnwEFqvOLrjogY=
\ No newline at end of file
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-tag-names.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-tag-names.xml
new file mode 100644
index 00000000000..152eb791985
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-tag-names.xml
@@ -0,0 +1,3 @@
+test1Bq8FsjajUBYPD7stQeJSc66GlM=cbNpPGavhM0BGUtrvLxvy2SCIt+I27BPpVEt0Q9mXrdPYurMqWF/67AdY9m5RqS7+ZZlwUtem083
+MczRYbKoOIq7sMbCqKKdzbSE/U6rfmky/ACQ5wgemZl8jtipwu5LhAUzjhzT8hhTjVqOYpHdkVJz
+l9dnd9eWbLmEr3BI0VA=
\ No newline at end of file
diff --git a/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-transform-algorithm.xml b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-transform-algorithm.xml
new file mode 100644
index 00000000000..a64abc75c46
--- /dev/null
+++ b/jdk/test/javax/xml/crypto/dsig/data/signature-wrong-transform-algorithm.xml
@@ -0,0 +1,4 @@
+
+test1Bq8FsjajUBYPD7stQeJSc66GlM=Wzyx3jgEKGwY+pBXBmqWLWhASHQYCCGZVii5sKKKeZUBKxNBthjiSVfzKANuLgX6zAt16XRycrSL
+zFKTPuvGeWVPDvd+KTNKCJxN9ccrG7v23EM7RY2eMJGu2r5DLfKwV7H6YuJPsOuWifVkKAhvq7gd
+6akJshxyAj9Ud+mjo48=
\ No newline at end of file