By some reason I always get exception in unit test when calling SecretKeyFactory.getInstance() no matter what algorithm is specified. For example:
SecretKeyFactory.getInstance("PBEWITHMD5ANDDES")
com.mhe.connect.util.EncryptionException: java.security.NoSuchAlgorithmException: PBEWITHMD5ANDDES SecretKeyFactory not available
At the same time, I see that Security.getProviders() returns me needed algorithms:
SECRETKEYFACTORY.DESEDE SunJCE
SECRETKEYFACTORY.PBEWITHMD5ANDDES SunJCE
SECRETKEYFACTORY.DES SunJCE
SECRETKEYFACTORY.PBEWITHMD5ANDTRIPLEDES SunJCE
SECRETKEYFACTORY.PBKDF2WITHHMACSHA1 SunJCE
SECRETKEYFACTORY.PBEWITHSHA1ANDDESEDE SunJCE
SECRETKEYFACTORY.PBEWITHSHA1ANDRC2_40 SunJCE
This happens only in unit tests (from Maven, or IDE) and works fine if code is running under Jetty (that is run from same Maven/JDK).
What could be the reason for such behavior?