8176183: sun/security/mscapi/SignedObjectChain.java fails on Windows
authorasmotrak
Wed, 08 Mar 2017 18:54:34 -0800
changeset 44116 fa73683c2c10
parent 44115 bb4e971bf5d4
child 44117 7108a2c20885
8176183: sun/security/mscapi/SignedObjectChain.java fails on Windows Reviewed-by: weijun
jdk/test/ProblemList.txt
jdk/test/java/security/SignedObject/Chain.java
--- a/jdk/test/ProblemList.txt	Wed Mar 08 17:17:41 2017 -0800
+++ b/jdk/test/ProblemList.txt	Wed Mar 08 18:54:34 2017 -0800
@@ -215,8 +215,6 @@
 javax/net/ssl/DTLS/PacketLossRetransmission.java                8169086 macosx-x64
 javax/net/ssl/DTLS/RespondToRetransmit.java                     8169086 macosx-x64
 
-sun/security/mscapi/SignedObjectChain.java                      8176183 windows-all
-
 sun/security/krb5/auto/Basic.java                               8176296 generic-all
 
 sun/security/ssl/X509KeyManager/PreferredKey.java               8176354 generic-all
--- a/jdk/test/java/security/SignedObject/Chain.java	Wed Mar 08 17:17:41 2017 -0800
+++ b/jdk/test/java/security/SignedObject/Chain.java	Wed Mar 08 18:54:34 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,8 +137,17 @@
             PrivateKey[] privKeys = new PrivateKey[N];
             PublicKey[] pubKeys = new PublicKey[N];
             PublicKey[] anotherPubKeys = new PublicKey[N];
-            KeyPairGenerator kpg = KeyPairGenerator.getInstance(
-                    test.keyAlg.name);
+            Signature signature;
+            KeyPairGenerator kpg;
+            if (test.provider != Provider.Default) {
+                signature = Signature.getInstance(test.sigAlg.name,
+                        test.provider.name);
+                kpg = KeyPairGenerator.getInstance(
+                    test.keyAlg.name, test.provider.name);
+            } else {
+                signature = Signature.getInstance(test.sigAlg.name);
+                kpg = KeyPairGenerator.getInstance(test.keyAlg.name);
+            }
             for (int j=0; j < N; j++) {
                 KeyPair kp = kpg.genKeyPair();
                 KeyPair anotherKp = kpg.genKeyPair();
@@ -154,14 +163,6 @@
                 }
             }
 
-            Signature signature;
-            if (test.provider != Provider.Default) {
-                signature = Signature.getInstance(test.sigAlg.name,
-                        test.provider.name);
-            } else {
-                signature = Signature.getInstance(test.sigAlg.name);
-            }
-
             // Create a chain of signed objects
             SignedObject[] objects = new SignedObject[N];
             objects[0] = new SignedObject(str, privKeys[0], signature);