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());