Determine whether your java install has limited key strength due to export restrictions
daniel Tue, 07/16/2013 - 2:28pm
Detect the allowed size of AES keys on the JVM on github by jehrhardt
Or, in Groovy:
import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
int allowedKeyLength = 0
try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES")
} catch (NoSuchAlgorithmException e) {
e.printStackTrace()
}
if(allowedKeyLength < Integer.MAX_VALUE){
println "The allowed key length for AES is: $allowedKeyLength, which is less than Integer.MAX_VALUE, and therefore 'Limited' as defined in the JavaDoc for Cipher.getMaxAllowedKeyLength()"
}else{
println "The allowed key length for AES is: $allowedKeyLength, which is equal to Integer.MAX_VALUE, and therefore 'Unlimited' as defined in the JavaDoc for Cipher.getMaxAllowedKeyLength()"
}
- Log in to post comments