EAServer’s HttpsURLConnection class

EAServer provides the com.sybase.jaguar.net.HttpsURLConnection class to support HTTPS connectivity. This class extends java.net.URLConnection and implements all methods of java.net.HttpURLConnection. HttpsURLConnection provides these additional methods specifically for SSL support:

StepsCreating HTTPS connections

  1. Configure or install the EAServer HTTPS protocol handler as described in “Installing the HTTPS protocol handler”.

  2. Create URL and URLConnection instances. If connecting to an EAServer, specify the address of an HTTPS listener that supports the desired level of security. For example:

    URL url = new URL("https://myhost:8081/index.html");
    URLConnection conn = url.openConnection();
    
  3. Verify that the object returned by URL.openConnection is of class com.sybase.jaguar.net.HttpsURLConnection, then set SSL properties for the connection. “SSL properties” describes the SSL properties that can be set. At a minimum, you must specify the qop and pin properties, as well as the certificateLabel property if using mutual authentication. For example:

    if (conn instanceof HttpsURLConnection)
    {
      HttpsURLConnection https_conn =     (HttpsURLConnection) conn;
      try
      {
        https_conn.setSSLProperty( "qop","sybpks_intl" ); 
        https_conn.setSSLProperty( "pin", "secret");
        https_conn.setSSLProperty(
               "certificateLabel", "John Smith");
      } 
      catch ( CtsSecurity.InvalidPropertyException ipe )
      {
        System.err.println( ipe );
      }
      catch ( CtsSecurity.InvalidValueException ive )
      {
        System.err.println( ive );
      }
    
  4. Open the connection, for example:

    conn.connect();
    

Once the connection is open, you can perform any valid operation for a connection that uses java.net.HTTPUrlConnection. You can also call the getSessionInfo method to retrieve a CtsSecurity.SSLSessionInfo instance that allows you to verify the SSL connection parameters. For example:

java.net.URLConnection conn;
... deleted code that constructed URLConnection ...
if (conn instanceof HttpsURLConnection)
{
  HttpsURLConnection https_conn =     (HttpsURLConnection) conn;
  CtsSecurity.SSLSessionInfo sessInfo = 
    https_conn.getSessionInfo();

The SSLSessionInfo methods allow you to determine the SSL session properties, such as the server’s address, the client certificate in use, the server certificate in use, and so forth. For more information, see the Interface Repository documentation for the CtsSecurity::SSLSessionInfo interface.