You are currently reviewing an older revision of this page.

Bad Key Encryption error occurs after upgrading to Appian versions 18.3 onwards

An issue with a bad key encryption occurs when starting tomcat after performing an upgrade of Appian from a version which required the customer to install their own application server.

Symptoms

When starting up tomcat for the first time the following error is logged within the application server log:

Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:991)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847)
    at com.sun.crypto.provider.BlowfishCipher.engineDoFinal(BlowfishCipher.java:319)
    at javax.crypto.Cipher.doFinal(Cipher.java:2164)
    at com.appiancorp.tomcat.encoding.EncodingCryptographer.decodePassword(EncodingCryptographer.java:25)
    at com.appiancorp.tomcat.datasource.EncodedPasswordDataSourceFactory.getObjectInstance(EncodedPasswordDataSourceFactory.java:36)
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:94)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:839

Cause

This occurs due to using the wrong encryption for the password section within your <APPIAN_HOME>/tomcat/apache-tomcat/tomcatResources.xml file.

Action

Use the Configure Script to encode your data source password and use the output to fill in the password property in your <APPIAN_HOME>/tomcat/apache-tomcat/tomcatResources.xml file.

Affected Versions

This article applies to Appian 18.3 and later.