Rate This Document
Findability
Accuracy
Completeness
Readability

AES Key Length Error Reported During Commons Crypto Compilation

Symptom

An error is reported during Commons Crypto compilation:

1
2
Failed tests:
  JceCipherTest.checkJceUnlimitedStrength:44 Testing requires support for an AES key length of 256,but the detected maximum key length is 128. This may indicate that the test environment is missing the JCE Unlimited Strength Jurisdiction Policy Files.

Key Process and Cause Analysis

The AES key length required by the test is 256. However, the supported maximum key length is 128.

Conclusion and Solution

  1. Download the jce_policy-8.zip package and decompress it. Then replace the Java library file with the decompressed file.
    1
    unzip jce_policy-8.zip
    
  2. The decompressed folder contains two JAR packages: local_policy.jar and US_export_policy.jar.
    1
    2
    cd UnlimitedJCEPolicyJDK8/
    ls
    
  3. View the JAVA_HOME directory.
    1
    cat /etc/profile
    
  4. Copy local_policy.jar and US_export_policy.jar to $JAVA_HOME/jre/lib/security.
    1
    2
    cp local_policy.jar US_export_policy.jar $JAVA_HOME/jre/lib/security
    ls
    
    • If you replace the static library with a dynamic library, the library may not be found during the running. You can install the corresponding static library to solve the problem.
    • You can check the JAVA_HOME directory in the /etc/profile file.
      1
      JAVA_HOME=/opt/tools/jdk8u222-b10
      
  5. Use the yum source to install the required glibc and libstdc++-static.
    1
    2
    yum install libstdc++-static.aarch64 -y
    yum install glibc* -y