在openjre中使用需要Java策略文件的加密 [英] Using encryption that would need Java Policy Files in openjre

查看:217
本文介绍了在openjre中使用需要Java策略文件的加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想使用java和加密与长度超过128位的密钥,我必须使用Java策略文件。如何使用openjre来运行这些应用程序?我得到相同的错误,我得到使用oracle jre没有策略文件,但我不能简单地使用Oracle策略文件?或者可以吗?

if i want to use java and encryption with keys longer than 128bit i have to use the Java Policy Files. How to get those applications up and running with openjre? I get the same error i get using oracle jre without policy files, but i can't simply use the Oracle Policy Files? or can i?

或者使用openjdk帮助构建项目?

Or would building the project with openjdk help?

谢谢

推荐答案

我发现如下。
似乎解决了我曾经遇到的所有政策问题。

I found the following. It seems to solve all the policy problems i ever had.

  try {
    Field field = Class.forName("javax.crypto.JceSecurity").getDeclaredField("isRestricted");
    field.setAccessible(true);
    field.set(null, java.lang.Boolean.FALSE);
  } catch (Exception ex) {

  }

不好,但工作!

这篇关于在openjre中使用需要Java策略文件的加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆