8270797: ShortECDSA.java test is not complete
Reviewed-by: mullan
This commit is contained in:
parent
0a27f264da
commit
221e4b9c61
@ -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;
|
||||
@ -91,6 +94,18 @@ public class ShortECDSA {
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user