Getting javax.crypto.BadPaddingException: Given final block not properly padded in JBoss Vault
Issue
- Recent java and
JBoss EAP
upgrade causedjavax.crypto.BadPaddingException: Given final block not properly padded error
. - Starting the
JBoss
application server intermittently fails withjavax.crypto.BadPaddingException: Given final block not properly padded error
. Expect theJBoss
application server to start. This error started happening when we upgraded fromjava 1.7._40
toJava 1.80_65
, and at the same time upgradedJBoss EAP
from6.1.0
to6.4.0
.
ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 20) JBAS014612: Operation ("enable") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "MYDatasource")
]): java.lang.SecurityException: JBAS013311: Security Exception
at org.jboss.as.security.vault.RuntimeVaultReader.retrieveFromVault(RuntimeVaultReader.java:115)
at org.jboss.as.server.RuntimeExpressionResolver.resolvePluggableExpression(RuntimeExpressionResolver.java:45)
...
Caused by: org.jboss.security.vault.SecurityVaultException: javax.crypto.BadPaddingException: Given final block not properly padded
at org.picketbox.plugins.vault.PicketBoxSecurityVault.retrieve(PicketBoxSecurityVault.java:297)
at org.jboss.as.security.vault.RuntimeVaultReader.getValue(RuntimeVaultReader.java:141)
at org.jboss.as.security.vault.RuntimeVaultReader.getValueAsString(RuntimeVaultReader.java:123)
at org.jboss.as.security.vault.RuntimeVaultReader.retrieveFromVault(RuntimeVaultReader.java:113)
... 26 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966) [sunjce_provider.jar:1.8.0_71]
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824) [sunjce_provider.jar:1.8.0_71]
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436) [sunjce_provider.jar:1.8.0_71]
at javax.crypto.Cipher.doFinal(Cipher.java:2165) [jce.jar:1.8.0_71]
at org.picketbox.util.EncryptionUtil.decrypt(EncryptionUtil.java:134)
at org.picketbox.plugins.vault.PicketBoxSecurityVault.retrieve(PicketBoxSecurityVault.java:293)
... 29 more
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.4
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.