import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
 
class ujce_test {
  public static void main(String[] args) {
    int maxKeyLength = -1;
    try {
      maxKeyLength = Cipher.getMaxAllowedKeyLength("AES");
    } catch (NoSuchAlgorithmException e) {
      throw new Error("No support for AES algorithm. Unexpected.");
    }

    if (!(maxKeyLength > 128)) {
      throw new Error("Max key length is: " + maxKeyLength + ". JCE Unlimited Strength Policy files are not detected. " +
      "JCE Unlimited Strength policy files are required to use Trustee key provider.");
    } else {
      System.out.println("JCE Unlimited Strength Policy files appear to be available. Max AES Cipher Key Length is " + maxKeyLength);
    }
  }
}
