我想将 Oracle JDK 配置为使用 IBM 的符合 FIPS 的 JCE/JSSE 安全提供程序。我需要哪些 JAR 文件以及它们应该安装在哪里?提供商应在清单中列出什么java.security
文件是什么样的?
我在 Sun jdk5 上使用 IBMJCE,它工作正常。我猜它可能类似于 fips
您需要 ibmjceprovider.jar、ibmpkcs.jar、ibmjcefips.jar
您可以在 ibm jre 中找到它们
代码是这样的
static{
//install ibm's provider
java.security.Security.addProvider(new IBMJCE());
}
public byte[] encrypt(byte[] input)throws SecurityException{
KeyGenerator kg = KeyGenerator.getInstance("DES");
//call ibm's provider
SecureRandom sr = SecureRandom.getInstance("IBMSecureRandom", new IBMJCE());
sr.setSeed(str.getBytes());
kg.init(sr);
Key key = kg.generateKey();
Cipher cipher = Cipher.getInstance("DES");
cipher.init(1, key);
byte[] ret = cipher.doFinal(input);
return ret;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)