changeset 54215:b00a4187d5ec

8221172: SunEC specific test is not limited to SunEC Summary: Fixing a minor test bug in the SignatureDigestTruncate regression test Reviewed-by: mullan
author apetcher
date Thu, 21 Mar 2019 13:10:37 -0400
parents 0288c6919a20
children f10ca228b22f
files test/jdk/sun/security/ec/SignatureDigestTruncate.java
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/sun/security/ec/SignatureDigestTruncate.java	Thu Mar 21 10:47:48 2019 -0400
+++ b/test/jdk/sun/security/ec/SignatureDigestTruncate.java	Thu Mar 21 13:10:37 2019 -0400
@@ -91,22 +91,25 @@
         String privateKeyStr, String msgStr, String kStr, String sigStr)
         throws Exception {
 
+        System.out.println("Testing " + alg + " with " + curveName);
+
         byte[] privateKey = Convert.hexStringToByteArray(privateKeyStr);
         byte[] msg = Convert.hexStringToByteArray(msgStr);
         byte[] k = Convert.hexStringToByteArray(kStr);
         byte[] expectedSig = Convert.hexStringToByteArray(sigStr);
 
-        AlgorithmParameters params = AlgorithmParameters.getInstance("EC");
+        AlgorithmParameters params =
+            AlgorithmParameters.getInstance("EC", "SunEC");
         params.init(new ECGenParameterSpec(curveName));
         ECParameterSpec ecParams =
             params.getParameterSpec(ECParameterSpec.class);
 
-        KeyFactory kf = KeyFactory.getInstance("EC");
+        KeyFactory kf = KeyFactory.getInstance("EC", "SunEC");
         BigInteger s = new BigInteger(1, privateKey);
         ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec(s, ecParams);
         PrivateKey privKey = kf.generatePrivate(privKeySpec);
 
-        Signature sig = Signature.getInstance(alg);
+        Signature sig = Signature.getInstance(alg, "SunEC");
         sig.initSign(privKey, new FixedRandom(k));
         sig.update(msg);
         byte[] computedSig = sig.sign();