JUnit cannot use 'long format' of encrypted password in site.properties

Document ID : KB000008455
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

InvalidKeyException error is thrown when running tests through junit. The "lisadb.pool.common.password_enc" in 'site.properties' file is by default encrypted into 'long format' which cannot be consumed by junit as 'InvalidKeyException' is thrown with below stack trace:

2016-10-31 10:29:09,558Z (10:29) [dbwriter for LISA Test Set to reproduce End Date issue writing 7 objects, started batch at 10/31/16 10:29 AM] ERROR com.itko.lisa.utils.db.ConnectionPoolManager - Could not decrypt password for pool common
java.security.InvalidKeyException: Illegal key size
	at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
	at javax.crypto.Cipher.implInit(Cipher.java:805)
	at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
	at javax.crypto.Cipher.init(Cipher.java:1396)
	at javax.crypto.Cipher.init(Cipher.java:1327)
	at com.itko.util.AESCrypto.decryptThis(AESCrypto.java:224)
Environment:
DevTest 10.0 on any OS
Cause:

This has been found to an limitation with JVM being used by JUnit which doesn't has Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. 

Resolution:

Since the JUnit test is unable to consume the long format of encrypted password, to resolve this issue, installing Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files to the JVM used by JUnit resolves this issue.