[xmlsectool] 06/06: XSTJ-34 - change default signing digest algorithm from SHA-1 to SHA-256

Ian Young ian at iay.org.uk
Wed Apr 27 13:25:29 EDT 2016


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

iay pushed a commit to branch master
in repository xmlsectool.

commit 154d1a798ab0a6d523d25d7b3e903d306e097a4b
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Apr 27 16:53:06 2016 +0100

    XSTJ-34 - change default signing digest algorithm from SHA-1 to SHA-256
---
 .../xmlsectool/XmlSecToolCommandLineArguments.java |  4 ++--
 .../XmlSecToolCommandLineArgumentsTest.java        | 25 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArguments.java b/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArguments.java
index c1b0007..f9a4fb8 100644
--- a/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArguments.java
+++ b/src/main/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArguments.java
@@ -886,7 +886,7 @@ public class XmlSecToolCommandLineArguments {
                 errorAndExit("digest choice \"" + digestName + "\" was not recognised");
             }
         } else {
-            digest = DigestChoice.SHA1;
+            digest = DigestChoice.SHA256;
         }
         
         if (doSign()) {
@@ -986,7 +986,7 @@ public class XmlSecToolCommandLineArguments {
         // out.println(String.format("  --%-20s %s", SIG_INC_PREFIX_ARG.longForm(),
         // "Specifies an inclusive namespace by prefix.  Option may be used more than once."));
         out.println(String.format("  --%-20s %s", digestArg.longForm(),
-                "Specifies the name of the digest algorithm to use: SHA-1 (default), SHA-256, SHA-384, SHA-512."
+                "Specifies the name of the digest algorithm to use: SHA-1, SHA-256 (default), SHA-384, SHA-512."
                         + "  For RSA and EC credentials, dictates both the digest and signature algorithms."));
         out.println(String.format("  --%-20s %s", digestAlgorithmArg.longForm(),
                 "Specifies the URI of the digest algorithm to use; overrides --"
diff --git a/src/test/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArgumentsTest.java b/src/test/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArgumentsTest.java
new file mode 100644
index 0000000..a896e01
--- /dev/null
+++ b/src/test/java/net/shibboleth/tool/xmlsectool/XmlSecToolCommandLineArgumentsTest.java
@@ -0,0 +1,25 @@
+package net.shibboleth.tool.xmlsectool;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import net.shibboleth.tool.xmlsectool.XmlSecToolCommandLineArguments.DigestChoice;
+
+public class XmlSecToolCommandLineArgumentsTest {
+
+	@Test
+	public void xstj34_sign_with_SHA256() throws Exception{
+		final String[] args = {
+				"--sign",
+				"--inFile", "in.xml",
+				"--outFile", "out.xml",
+				"--certificate", "example.crt",
+				"--key", "example.key"
+				};
+		final XmlSecToolCommandLineArguments cli = new XmlSecToolCommandLineArguments();
+		cli.parseCommandLineArguments(args);
+		final DigestChoice digest = cli.getDigest();
+		Assert.assertNotNull(digest);
+		Assert.assertSame(digest, DigestChoice.SHA256);
+	}
+}

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


More information about the commits mailing list