Skip to content

Instantly share code, notes, and snippets.

@jehrhardt
Created March 15, 2013 06:23

Revisions

  1. jehrhardt created this gist Mar 15, 2013.
    16 changes: 16 additions & 0 deletions KeyLengthDetector.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    import javax.crypto.Cipher;
    import java.security.NoSuchAlgorithmException;

    public class KeyLengthDetector {
    public static void main(String[] args) {
    int allowedKeyLength = 0;

    try {
    allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES");
    } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
    }

    System.out.println("The allowed key length for AES is: " + allowedKeyLength);
    }
    }