In Java, there is a limitation on key size by the JCE Jurisdiction Policy. If you manipulate a private key with bit size which is larger than the limitation, it will throw a InvalidKeyException complaining about Illegal key size.
The following piece of Java code will check maximum key size of all the algorithms and print the result to the console.
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Set;
import javax.crypto.Cipher;
public class CheckKeySize {
public static void main(String[] args) {
try {
Set<String> algorithms = Security.getAlgorithms("Cipher");
for(String algorithm: algorithms) {
int max;
max = Cipher.getMaxAllowedKeyLength(algorithm);
System.out.printf("%-22s: %dbit%n", algorithm, max);
}
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
}
Console output
BLOWFISH : 128bit ARCFOUR : 128bit PBEWITHMD5ANDDES : 128bit RC2 : 128bit RSA : 2147483647bit PBEWITHMD5ANDTRIPLEDES: 128bit PBEWITHSHA1ANDDESEDE : 128bit DESEDE : 2147483647bit AESWRAP : 128bit AES : 128bit DES : 64bit DESEDEWRAP : 128bit RSA/ECB/PKCS1PADDING : 2147483647bit PBEWITHSHA1ANDRC2_40 : 128bit
Done =)
Reference: セキュリティ

I found your page from Google search 😉
LikeLike
haha~
so could you find what you need? =P
LikeLike
Yes – found this with google search. thanks for posting this…
LikeLike
you are welcome =)
LikeLike
Just what I needed to keep track of the Java installs on the servers. Thanks.
LikeLike
Great, glad to know that it could help. =)
LikeLike