Skip to content

Instantly share code, notes, and snippets.

@ryanwoodsmall
Created July 7, 2016 18:02
Show Gist options
  • Save ryanwoodsmall/12837ef0cee94d099bc819c72c555fa5 to your computer and use it in GitHub Desktop.
Save ryanwoodsmall/12837ef0cee94d099bc819c72c555fa5 to your computer and use it in GitHub Desktop.
JCE unlimited strength crypto checker
// exit code 0 if JCE is available, 1 otherwise
/*
* one-liner:
* jrunscript -e 'exit (javax.crypto.Cipher.getMaxAllowedKeyLength("AES") < 256);'
*/
import javax.crypto.Cipher;
public class jcecheck {
public static void main(String[] args) throws Exception {
int maxrc5 = Cipher.getMaxAllowedKeyLength("RC5");
int maxaes = Cipher.getMaxAllowedKeyLength("AES");
//System.out.println("max RC5 = " + maxrc5);
//System.out.println("max AES = " + maxaes);
System.exit((maxaes < 256) ? 1 : 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment