Java Security: Illegal key size or default parameters?

前端 未结 19 1738
日久生厌
日久生厌 2020-11-22 03:34

I had asked a question about this earlier, but it didn\'t get answered right and led nowhere.

So I\'ve clarified few details on the problem and I would really like t

19条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 03:44

    the problem is the content of the file default_local.policy in local_policy.jar in the folder jre\lib\security, if you install the JRE:

    // Some countries have import limits on crypto strength. This policy file
    // is worldwide importable.
    
    grant {
        permission javax.crypto.CryptoPermission "DES", 64;
        permission javax.crypto.CryptoPermission "DESede", *;
        permission javax.crypto.CryptoPermission "RC2", 128,
                                         "javax.crypto.spec.RC2ParameterSpec", 128;
        permission javax.crypto.CryptoPermission "RC4", 128;
        permission javax.crypto.CryptoPermission "RC5", 128,
              "javax.crypto.spec.RC5ParameterSpec", *, 12, *;
        permission javax.crypto.CryptoPermission "RSA", *;
        permission javax.crypto.CryptoPermission *, 128;
    };
    

    if you do not need worldwide valid settings you simply can edit this file and change the content to

    // Country-specific policy file for countries with no limits on crypto strength.
    grant {
        // There is no restriction to any algorithms.
        permission javax.crypto.CryptoAllPermission;
    };
    

    this is what get if you download the JCE from Oracle.

提交回复
热议问题