You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I'm in the process of writing a build script to install and deploy EJBCA CE (8.2.0.1) under Wildfly (26.1.3) running with Java 11.
Following the documentation for configuring Wildfly and EJBCA I discovered an issue when generating random secure passwords for the truststore between EJBCA and Wildfly.
If the password I generate is all hexadecimal characters and the length is a multiple of 32, the underlying library (cesecore-common/src/org/cesecore/util/StringTools.java) interprets this password as being already encrypted, and throws the following exception from the passwordDecryption function:
Password decryption failed. 'password.encryption.key' might have been modified more than once.
To Reproduce
From a fresh server:
Download and install all dependencies (database of choice, OpenJDK 11)
Download, install, and start up Wildfly
Select two random hexadecimal strings (length a multiple of 32) for your Java trust password and https server password and run the following:
If the failure to decrypt is expected and desired behaviour, maybe there could be a simple check on the values in web.properties can alert the user rather than cryptically fail.
Product Deployment
Please complete the following information:
Server OS: Ubuntu 22.04 LTS
Java: openjdk 11.0.22
Wildfly Version: 26.1.3
EJBCA-CE Version: 8.2.0.1
Workaround
If you're going to use random hex passwords to protect the trust stores, use any value whose length isn't a multiple of 32.
The text was updated successfully, but these errors were encountered:
Thanks, it's something to investigate certainly. It is due to legacy backwards compatibility, the punishment for being able to work with 15 year old data. Newer data have more data in the encrypted string (algorithm, salt and such), but really really old didn't.
There are many options:
you of course worked around it by modifying the string, so there is no critical issue, it's possible to leave it like that
add code to assume that if decryption failed the last time, assume that it's supposed to be like that
remove the backwards compatibility for really old data
I'd say that without any other context the second option makes most sense to me, possibly with a final check to see if the provided value is the trust store password itself without modification.
Alternatively, a more explicit error message might be enough.
This could come up even with values that aren't (completely) randomly generated, if for some reason a user decided to use a pre-generated 128 or 256-bit AES key (196-bit would be fine as the length would be 48 characters).
The passphrase is used to derive a symmetric cryptographic key, i.e. AES. So using an AES key as input is not recommended, i.e. you don't use an AES key to derive an AES key. A (random) alphanumerical string utilizing the full character set is a much better option.
Describe the Bug
I'm in the process of writing a build script to install and deploy EJBCA CE (8.2.0.1) under Wildfly (26.1.3) running with Java 11.
Following the documentation for configuring Wildfly and EJBCA I discovered an issue when generating random secure passwords for the truststore between EJBCA and Wildfly.
If the password I generate is all hexadecimal characters and the length is a multiple of 32, the underlying library (cesecore-common/src/org/cesecore/util/StringTools.java) interprets this password as being already encrypted, and throws the following exception from the passwordDecryption function:
Password decryption failed. 'password.encryption.key' might have been modified more than once.
To Reproduce
From a fresh server:
Expected Behavior
If the failure to decrypt is expected and desired behaviour, maybe there could be a simple check on the values in web.properties can alert the user rather than cryptically fail.
Product Deployment
Please complete the following information:
Workaround
If you're going to use random hex passwords to protect the trust stores, use any value whose length isn't a multiple of 32.
The text was updated successfully, but these errors were encountered: