Skip to content

Instantly share code, notes, and snippets.

@Filirom1
Forked from nogweii/Test.java
Created February 20, 2018 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Filirom1/1c95657d7ccd2a4c2d1cb34701ae5f38 to your computer and use it in GitHub Desktop.
Save Filirom1/1c95657d7ccd2a4c2d1cb34701ae5f38 to your computer and use it in GitHub Desktop.
A quick test to see if you have the JCE Unlimited Strength Jurisdiction Policy files installed. If you don't, in Java 6 you'll see 128. If you do, you'll see 2147483647. Thanks to http://stackoverflow.com/questions/11538746/check-for-jce-unlimited-strength-jurisdiction-policy-files
#!/bin/bash
javac Test.java
java Test
import javax.crypto.Cipher;
class Test {
public static void main(String[] args) {
try {
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
if(maxKeyLen>128){
System.out.println("unlimited");
}else{
System.out.println("limited");
}
} catch (Exception e){
System.out.println("Sad world :(");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment