java - 使用 com.ibm.websphere.crypto.PasswordUtil.decode 时出现 InvalidPasswordCipherException

标签 java websphere aes

我正在使用以下版本的 WebSphere:

Launching defaultServer (WebSphere Application Server 19.0.0.6/wlp-1.0.29.cl190620190617-1530) on IBM J9 VM, version 8.0.5.37 - pxa6480sr5fp37-20190618_01(SR5 FP37) (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.

我已将以下内容添加到build.gradle:

compile("com.ibm.websphere.appserver.spi:com.ibm.websphere.appserver.spi.kernel.service:1.5.15")

bootstrap.properties中,有一个AES编码的字符串:

user@service-pod:/opt/ibm/wlp/usr/servers/defaultServer$ cat bootstrap.properties 
SECRET="{aes}AJIZlX1899cct50fB2yUIcNdD5rp0yVhxtPnNKyuShGQh0T+VBzxnfU5G1S9hCYQioa3/hMj+qPAUnliv96B6aFAsWnGk7RiY42yslztDT6Y"

使用以下方式进行编码:securityUtility编码--encoding=aes $PLAINTEXT

但是当我尝试使用以下方法从 Java Web 应用程序中解码字符串时:

System.out.println(PasswordUtil.decode(System.getProperty("SECRET")));

我遇到了这个异常:

org.apache.cxf.interceptor.Fault: com.ibm.ws.crypto.util.InvalidPasswordCipherException
    at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
    at [internal classes]
Caused by: java.lang.NoClassDefFoundError: com.ibm.ws.crypto.util.InvalidPasswordCipherException

有什么想法吗?

最佳答案

需要

server.xml:

<feature>passwordUtilities-1.0</feature>

关于java - 使用 com.ibm.websphere.crypto.PasswordUtil.decode 时出现 InvalidPasswordCipherException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58290133/

相关文章:

java - Java中如何将不支持的字符转换为html实体

java - 为什么类 CloneNotSupportedException 是一个已检查的异常,而不是扩展 RuntimeException?

java - 从纯客户端调用远程 EJB(RMI over IIOP)时如何传播 JAAS Subject

java - 在 Websphere 中获取 500 NullPointerException - Apache Wink Rest 服务

java - 如何处理从 servlet 中的 Angular 应用程序发送的预检请求?

java - @Pathvariable 的 UrlMapping 通配符

http - 如何查看 Websphere 应用程序服务器 (WAS) 响应

c++ - 256 位 Rijndael block 大小?

java - javascript中的AES加密和java中的解密

go - 如何解密 privnote 上的消息?