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

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

book

Article ID: 8455

calendar_today

Updated On:

Products

CA Application Test CA Continuous Application Insight (PathFinder) Service Virtualization

Issue/Introduction

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

All supported DevTest releases.

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.