8221271: sun/security/pkcs11/tls/tls12/TestTLS12.java test failed

Reviewed-by: xuelei
This commit is contained in:
Martin Balao 2019-04-19 10:59:09 -03:00
parent a8550e4589
commit a8a29bbae6
3 changed files with 10 additions and 14 deletions

View File

@ -263,13 +263,13 @@ public final class RSACipher extends CipherSpi {
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());

View File

@ -715,7 +715,6 @@ sun/security/pkcs11/tls/TestLeadingZeroesP11.java 8204203 windows-
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
############################################################################

View File

@ -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.FileInputStream;
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 @@ public final class TestTLS12 extends SecmodTest {
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 @@ public final class TestTLS12 extends SecmodTest {
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) {