Created
August 20, 2013 16:23
-
-
Save bringhurst/6283751 to your computer and use it in GitHub Desktop.
A basic sanity test of the local AES key length.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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