我正在使用 Java Web 应用程序,我需要使用 3DES 算法生成 MAC。代码在 Weblogic 10.3 上运行没有问题,但是当我尝试在不同的 Weblogic 类似版本 (10.3.1) 中运行应用程序时出现问题。
这是我的代码:
public String getMac(String inkey, String data) throws Exception {
byte[] out = new byte[8];
try {
// if I commend this line, the result is the same
Security.addProvider(new BouncyCastleProvider());
// this loop proves the BC provider is there
for (Provider p : Security.getProviders()) {
log.debug("--");
log.debug(p.getName());
log.debug(p.getInfo());
}
try {
BouncyCastleProvider bc = new BouncyCastleProvider();
// class is there, no problem
log.debug("info" + bc.getInfo());
DES9797Alg3 …
Run Code Online (Sandbox Code Playgroud)