jdk/test/sun/security/mscapi/ShortRSAKeyWithinTLS.java
Print this page
rev 5695 : 8003403: Test ShortRSAKeyWithinTLS and ClientJSSEServerJSSE failing after 7u11 cleanup
Reviewed-by: xuelei
*** 27,37 ****
import java.security.*;
import javax.net.*;
import javax.net.ssl.*;
import java.lang.reflect.*;
! import sun.security.util.KeyLength;
public class ShortRSAKeyWithinTLS {
/*
* =============================================================
--- 27,37 ----
import java.security.*;
import javax.net.*;
import javax.net.ssl.*;
import java.lang.reflect.*;
! import sun.security.util.KeyUtil;
public class ShortRSAKeyWithinTLS {
/*
* =============================================================
*** 173,189 ****
if (ks.containsAlias(keyAlias)) {
System.out.println("Loaded entry: " + keyAlias);
privateKey = (PrivateKey)ks.getKey(keyAlias, null);
publicKey = (PublicKey)ks.getCertificate(keyAlias).getPublicKey();
! int privateKeySize = KeyLength.getKeySize(privateKey);
if (privateKeySize != keySize) {
throw new Exception("Expected key size is " + keySize +
", but the private key size is " + privateKeySize);
}
! int publicKeySize = KeyLength.getKeySize(publicKey);
if (publicKeySize != keySize) {
throw new Exception("Expected key size is " + keySize +
", but the public key size is " + publicKeySize);
}
}
--- 173,189 ----
if (ks.containsAlias(keyAlias)) {
System.out.println("Loaded entry: " + keyAlias);
privateKey = (PrivateKey)ks.getKey(keyAlias, null);
publicKey = (PublicKey)ks.getCertificate(keyAlias).getPublicKey();
! int privateKeySize = KeyUtil.getKeySize(privateKey);
if (privateKeySize != keySize) {
throw new Exception("Expected key size is " + keySize +
", but the private key size is " + privateKeySize);
}
! int publicKeySize = KeyUtil.getKeySize(publicKey);
if (publicKeySize != keySize) {
throw new Exception("Expected key size is " + keySize +
", but the public key size is " + publicKeySize);
}
}