Skip to content

Instantly share code, notes, and snippets.

@hansdg1
Created March 16, 2017 18:25
Show Gist options
  • Save hansdg1/0ac99910b447bf99dddb31e77491b481 to your computer and use it in GitHub Desktop.
Save hansdg1/0ac99910b447bf99dddb31e77491b481 to your computer and use it in GitHub Desktop.
import javax.crypto.Cipher;
class CipherTest {
public static void main(String args[]) {
try {
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
if(maxKeyLen < 256) {
System.out.println("FAILED: Max key length too small! (" + maxKeyLen + ").");
} else {
System.out.println("PASSED: Max key length OK! (" + maxKeyLen + ").");
}
} catch(Exception e) {
System.out.println("FAILED: No AES found!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment