Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8270797: ShortECDSA.java test is not complete
Reviewed-by: mullan
  • Loading branch information
wangweij committed Aug 4, 2021
1 parent 0a27f26 commit 221e4b9
Showing 1 changed file with 16 additions and 1 deletion.
Expand Up @@ -25,9 +25,12 @@
* @test
* @bug 8259535
* @summary ECDSA SignatureValue do not always have the specified length
* @modules java.xml.crypto
* @modules java.xml.crypto/com.sun.org.apache.xml.internal.security
* java.xml.crypto/com.sun.org.apache.xml.internal.security.signature
*/

import com.sun.org.apache.xml.internal.security.Init;
import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
Expand Down Expand Up @@ -91,6 +94,18 @@ public static void main(String[] args) throws Exception {
System.out.println(HexFormat.ofDelimiter(":").formatHex(sig));
throw new RuntimeException("Failed");
}

// Internal way
Init.init();
XMLSignature signature = new XMLSignature(document, null,
SignatureMethod.ECDSA_SHA256, CanonicalizationMethod.INCLUSIVE);
signature.sign(privateKey);
sig = signature.getSignatureValue();
if (sig.length != 64) {
System.out.println("Length: " + sig.length);
System.out.println(HexFormat.ofDelimiter(":").formatHex(sig));
throw new RuntimeException("Failed");
}
}

public static class XmlSigningUtils {
Expand Down

3 comments on commit 221e4b9

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 221e4b9 Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-221e4b9c in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 221e4b9c from the openjdk/jdk repository.

The commit being backported was authored by Weijun Wang on 4 Aug 2021 and was reviewed by Sean Mullan.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev TheRealMDoerr-backport-221e4b9c:TheRealMDoerr-backport-221e4b9c
$ git checkout TheRealMDoerr-backport-221e4b9c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev TheRealMDoerr-backport-221e4b9c

Please sign in to comment.