Forwarded to the list for a non-member (Jeremy Geffre 
<[EMAIL PROTECTED]>). Jeremy, please visit 
http://listserver.u2ug.org/ to subscribe.

I'm having problems getting UniObjects to connect over SSL 
and was wondering if anyone has any suggestions.  We are on 
UniData 6.03, and so far I have done the following:

1)  Added the IBM security provider to the list in 
java.security
2)  Added the UniObject jar files and ibmjsse.jar to the 
classpath
3)  Created a Security Context Record and changed the files 
unirpcservices and .scrfile
4)  Restarted unirpcd
5)  Created a truststore and imported the CA root 
certificate into it
6)  Created a keystore and imported a signed certificate 
into it
7)  Wrote a simple class and ran it

The exception is pretty vague and states:

The connection is bad, and may be passing corrupt data = 
81001
asjava.uniobjects.UniSessionException: The connection is 
bad, and may be passing corrupt data
        at 
asjava.uniobjects.UniSession.connect(UniSession.java:323)
        at UOJTestSSL.main(UOJTestSSL.java:39)

The class class I'm using is for a direct connection and 
contains the following code:

import asjava.uniobjects.*;
import asjava.uniclientlibs.*;
import asjava.unirpc.*;

public class UOJTestSSL
{
  static final String u2host = "ourhost";
  static final String username = "username";
  static final String password = "passwd";
  static final String accountpath = "/path/to/account";
  static final String keyfilepath = "/path/to/keyfile";
  static final String keyfilepwd = "keypwd";
  static final String trustfilepath = "/path/to/testtrust";
  static final String trustfilepwd = "trustpwd";

  public static void main (String args[])
  {
    try
    {
      UniJava uJava = new UniJava();
      UniSession uSession = 
uJava.openSession(UniObjectsTokens.SECURE_SESSION);
      // UniSession uSession = uJava.openSession(); ** 
Works with this line (non-secure) **

 
uSession.setHostPort(UniRPCTokens.UNIRPC_DEFAULT_PORT);
      uSession.setHostName(u2host);
      uSession.setUserName(username);
      uSession.setPassword( password );
      uSession.setAccountPath(accountpath);

      // Now we ll set locations for the keystore and 
truststore and a password
for the keystore

      System.setProperty("javax.net.ssl.trustStore", 
trustfilepath);
      System.setProperty("javax.net.ssl.keyStore", 
keyfilepath);
      System.setProperty("javax.net.ssl.keyStorePassword", 
keyfilepwd);
 
System.setProperty("javax.net.ssl.trustStorePassword", 
trustfilepwd);

      uSession.setSSLDescriptor(null);

      uSession.connect();

      // Instantiate a command object and set the command
      UniCommand uvc = uSession.command ();
      uvc.setCommand ("COUNT PERSON WITH FIRST.NAME = 
'Jeremy'");

      // Execute the command
      uvc.exec();

      // Print the response
      System.out.println (uvc.response ());

      // Disconnect from the Database
      uSession.disconnect();
    }
    catch (UniSessionException e)
    {
      System.out.println ( e.getMessage() + " = " + 
e.getErrorCode() );
      e.printStackTrace();
    }
    catch (UniCommandException e)
    {
      System.out.println ( e.getMessage() + " = " + 
e.getErrorCode() );
    }
  }
}

Please let me know if you have any ideas or suggestions. 
If someone has a simple working class that uses SSL, I 
would appreciate getting a copy.  Thanks,

Jeremy Geffre
Programmer Analyst
Linfield College
503-883-2554

[demime 1.01d removed an attachment of type text/x-vcard which had a name of u2ug.vcf]
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to