Search code examples
javawebsphereaes

InvalidPasswordCipherException when using com.ibm.websphere.crypto.PasswordUtil.decode


I'm using the following version of 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.

I've added the following to build.gradle:

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

In bootstrap.properties, there is an AES encoded string:

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

Which was encoded using: securityUtility encode --encoding=aes $PLAINTEXT

But when I try to decode the string from within the Java Web Application using:

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

I'm getting this exception:

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

Any ideas why?


Solution

  • server.xml needed:

    <feature>passwordUtilities-1.0</feature>