How to avoid installing “Unlimited Strength” JCE policy files when deploying an application?

前端 未结 11 2367
鱼传尺愫
鱼传尺愫 2020-11-22 07:43

I have an app that uses 256-bit AES encryption which is not supported by Java out of the box. I know to get this to function correctly I install the JCE unlimited strength j

11条回答
  •  面向向阳花
    2020-11-22 08:29

    You could use method

    javax.crypto.Cipher.getMaxAllowedKeyLength(String transformation)
    

    to test the available key length, use that and inform the user about what is going on. Something stating that your application is falling back to 128 bit keys due to the policy files not being installed, for example. Security conscious users will install the policy files, others will continue using weaker keys.

提交回复
热议问题