问题
DB2 has authentication type SERVER_ENCRYPT, but when I try to get connected:
Properties properties = new Properties();
properties.setProperty("securityMechanism",
Integer.toString(DB2BaseDataSource.ENCRYPTED_USER_AND_PASSWORD_SECURITY));
properties.setProperty("user", userDRS);
properties.setProperty("password", passwordDRS);
connDRS =DriverManager.getConnection(urlDRS, properties);
I obtain
[ERROR] resources.DB2Util 'com.ibm.db2.jcc.b.SqlException: [jcc][1071][10611][3.50.152] Caught java.security.InvalidAlgorithmParameterException while initializing EncryptionManager. See attached Throwable for details. ERRORCODE=-4223, SQLSTATE=null'
Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive) at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenera tor.java:120) at java.security.KeyPairGenerator$Delegate.initialize(Unknown Source) at java.security.KeyPairGenerator.initialize(Unknown Source) at com.ibm.db2.jcc.b.ic.(ic.java:75) ... 57 more
The problem that this code is being run from bat file, but if I run the code from studio (rational functional tester) - everything is fine, I get a connection. Bat file is:
@ECHO OFF
:start
:save_args_as_variables
set RFT_PROJECT_LOCATION="D:\RFTworkspace\PROD\IPPF\DataTransferRobo"
set RFT_SCRIPT_NAME="Main.Main"
set RFT_LOGFILE_NAME="test"
goto check_args
:check_args
if "%RFT_PROJECT_LOCATION%" == "" goto missing_args
if "%RFT_SCRIPT_NAME%" == "" goto missing_args
if "%RFT_LOGFILE_NAME%" == "" goto missing_args
goto args_ok
:args_ok
if "%4" == "silent" goto playback
echo.
echo RFT_PROJECT_LOCATION = %RFT_PROJECT_LOCATION%
echo RFT_SCRIPT_NAME = %RFT_SCRIPT_NAME%
echo RFT_LOGFILE_NAME = %RFT_LOGFILE_NAME%
echo IBM_RATIONAL_RFT_ECLIPSE_DIR = %IBM_RATIONAL_RFT_ECLIPSE_DIR%
echo IBM_RATIONAL_RFT_INSTALL_DIR = %IBM_RATIONAL_RFT_INSTALL_DIR%
echo.
echo Initializing RFT Playback...
:playback
"%IBM_RATIONAL_RFT_ECLIPSE_DIR%\jdk\jre\bin\java"
java -classpath "%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.jar;%RFT_PROJECT_LOCATION%\db2jcc.jar;%RFT_PROJECT_LOCATION%\mail.jar;%RFT_PROJECT_LOCATION%\log4j-1.2.15.jar;%RFT_PROJECT_LOCATION%\log4j.xml;" com.rational.test.ft.rational_ft -datastore %RFT_PROJECT_LOCATION% -playback %RFT_SCRIPT_NAME% -log %RFT_LOGFILE_NAME%
if "%4" == "silent" goto end
echo RFT playback complete.
goto end
:missing_args
echo.
echo ERROR: Invalid syntax! Usage:
echo RFT_PlayScript ProjectPath ScriptName LogName [silent]
goto end
:end
So, do I need some additional parameter in bat file or maybe I miss something essential ? (code was perfectly working before implementing encryption on DB2)
来源:https://stackoverflow.com/questions/10649009/java-security-invalidalgorithmparameterexception-while-initializing-encryptionma