changeset 55937:2de1c3fa3e7d

8221271: sun/security/pkcs11/tls/tls12/TestTLS12.java test failed Reviewed-by: xuelei
author mbalao
date Fri, 19 Apr 2019 10:59:09 -0300
parents 9fe44a3335b2
children 3452d108d06d
files src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java test/jdk/ProblemList.txt test/jdk/sun/security/pkcs11/tls/tls12/TestTLS12.java
diffstat 3 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java	Fri Apr 19 11:18:06 2019 -0700
+++ b/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java	Fri Apr 19 10:59:09 2019 -0300
@@ -263,13 +263,13 @@
             throw new InvalidKeyException("Unknown mode: " + opmode);
         }
         RSAKey rsaKey = RSAKeyFactory.toRSAKey(key);
-        if (key instanceof RSAPublicKey) {
+        if (rsaKey instanceof RSAPublicKey) {
             mode = encrypt ? MODE_ENCRYPT : MODE_VERIFY;
-            publicKey = (RSAPublicKey)key;
+            publicKey = (RSAPublicKey)rsaKey;
             privateKey = null;
         } else { // must be RSAPrivateKey per check in toRSAKey
             mode = encrypt ? MODE_SIGN : MODE_DECRYPT;
-            privateKey = (RSAPrivateKey)key;
+            privateKey = (RSAPrivateKey)rsaKey;
             publicKey = null;
         }
         int n = RSACore.getByteLength(rsaKey.getModulus());
--- a/test/jdk/ProblemList.txt	Fri Apr 19 11:18:06 2019 -0700
+++ b/test/jdk/ProblemList.txt	Fri Apr 19 10:59:09 2019 -0300
@@ -715,7 +715,6 @@
 sun/security/pkcs11/tls/TestMasterSecret.java                   8204203 windows-all
 sun/security/pkcs11/tls/TestPRF.java                            8204203 windows-all
 sun/security/pkcs11/tls/TestPremaster.java                      8204203 windows-all
-sun/security/pkcs11/tls/tls12/TestTLS12.java                    8221271 windows-all
 sun/security/tools/keytool/NssTest.java                         8204203 windows-all
 
 ############################################################################
--- a/test/jdk/sun/security/pkcs11/tls/tls12/TestTLS12.java	Fri Apr 19 11:18:06 2019 -0700
+++ b/test/jdk/sun/security/pkcs11/tls/tls12/TestTLS12.java	Fri Apr 19 10:59:09 2019 -0300
@@ -29,7 +29,7 @@
  *          java.base/sun.security.util
  *          java.base/com.sun.crypto.provider
  * @library /test/lib ../..
- * @run main/othervm/timeout=120 TestTLS12
+ * @run main/othervm/timeout=120 -Djdk.tls.useExtendedMasterSecret=false TestTLS12
  */
 
 import java.io.File;
@@ -37,8 +37,8 @@
 import java.io.InputStream;
 import java.nio.ByteBuffer;
 
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
+import java.security.PrivateKey;
+import java.security.PublicKey;
 import java.security.KeyStore;
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
@@ -76,8 +76,8 @@
     private static KeyStore ks;
     private static KeyStore ts;
     private static char[] passphrase = "JAHshj131@@".toCharArray();
-    private static RSAPrivateKey privateKey;
-    private static RSAPublicKey publicKey;
+    private static PrivateKey privateKey;
+    private static PublicKey publicKey;
 
     public static void main(String[] args) throws Exception {
         try {
@@ -444,14 +444,11 @@
         ts = ks;
 
         KeyStore ksPlain = readTestKeyStore();
-        privateKey = (RSAPrivateKey)ksPlain.getKey("rh_rsa_sha256",
+        privateKey = (PrivateKey)ksPlain.getKey("rh_rsa_sha256",
                 passphrase);
-        publicKey = (RSAPublicKey)ksPlain.getCertificate(
+        publicKey = (PublicKey)ksPlain.getCertificate(
                 "rh_rsa_sha256").getPublicKey();
 
-        // Extended Master Secret is not currently supported in SunPKCS11
-        // cryptographic provider
-        System.setProperty("jdk.tls.useExtendedMasterSecret", "false");
         String disabledAlgorithms =
                 Security.getProperty("jdk.tls.disabledAlgorithms");
         if (disabledAlgorithms.length() > 0) {