Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Posts
    10

    Unanswered: Issues while connectinG to database using DATA_ENCRYPT

    Hi,
    I am using the foolowig piece of code to connect to the database. The database has the Authentication type defined as DATA_ENCRYPT.

    Class.forName("com.ibm.db2.jcc.DB2Driver");
    final Properties properties = new Properties();
    properties.put("user", "XXXXXXXX");
    properties.put("password", "XXXXXXX");
    properties
    .put(
    "securityMechanism",
    new String(
    ""
    + com.ibm.db2.jcc.DB2BaseDataSource.ENCRYPTED_USER_A ND_DATA_SECURITY
    + ""));
    final String url = "jdbc:db2://<IP Address>:<port>/<database name>";
    final Connection conn = DriverManager
    .getConnection(url, properties);



    However when I try to run this code I am getting the follwoing errors

    com.ibm.db2.jcc.am.SqlException: [jcc][1071][10615][3.58.82] Caught java.security.InvalidAlgorithmParameterException while initializing EncryptionManager. See attached Throwable for details. ERRORCODE=-4223, SQLSTATE=null
    at com.ibm.db2.jcc.am.ed.a(ed.java:660)
    at com.ibm.db2.jcc.am.ed.a(ed.java:60)
    at com.ibm.db2.jcc.am.ed.a(ed.java:85)
    at com.ibm.db2.jcc.am.pc.a(pc.java:152)
    at com.ibm.db2.jcc.t4.b.Zc(b.java:2427)
    at com.ibm.db2.jcc.t4.b.c(b.java:727)
    at com.ibm.db2.jcc.t4.b.b(b.java:686)
    at com.ibm.db2.jcc.t4.b.a(b.java:367)
    at com.ibm.db2.jcc.t4.b.<init>(b.java:307)
    at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection( DB2SimpleDataSource.java:214)
    at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:4 56)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JDBCConnectivity.EncryptionConnectivity.main(Encry ptionConnectivity.java:40)
    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.initial ize(DashoA12275)
    at java.security.KeyPairGenerator$Delegate.initialize (Unknown Source)
    at java.security.KeyPairGenerator.initialize(Unknown Source)
    at com.ibm.db2.jcc.am.pc.a(pc.java:141)
    ... 10 more


    Can someone kindly suggest me if I am missing something

    Regards
    Siddharth Shah

  2. #2
    Join Date
    Jan 2010
    Posts
    335
    Hi,

    let's start with the obvious:

    There's a blank in
    ENCRYPTED_USER_A ND_DATA_SECURITY

    If it's in your source-code aswell, you might have your solution.

    nvk

  3. #3
    Join Date
    Dec 2009
    Posts
    10
    Hi,
    I have introduced a space in the post by mistake.

    Regards
    Siddharth Shah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •