How to install Unlimited Strength Jurisdiction Policy Files?

前端 未结 6 1030
猫巷女王i
猫巷女王i 2020-12-19 02:15

Can someone explain to me how to install Unlimited Strength Jurisdiction Policy Files. I downloaded .jar files from Oracle website but I\'m having a problem with installing

6条回答
  •  借酒劲吻你
    2020-12-19 02:43

    To programmatically handle this, The following code in Scala will help you do it. The code given above will not work for java version 8. You will get an error. Error : Can not set static final boolean field javax.crypto.JceSecurity.isRestricted to java.lang.Boolean

    if (Cipher.getMaxAllowedKeyLength("AES") < 256) {
     try {
     var field=Class.forName("javax.crypto.JceSecurity").getDeclaredField("isRestricted")
        field.setAccessible(true)
       var modifiersField = classOf[Field].getDeclaredField( "modifiers" )
       modifiersField.setAccessible(true);
       modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
        field.set(null, java.lang.Boolean.FALSE)
      }
    
      catch{
        case ex:Exception=>throw ex
      }
    }
    

提交回复
热议问题