World's most popular travel blog for travel bloggers.

What are the different components to be used while writing SSL client application ? Discuss. Write sample codes for SSL client and SSL Client Servelet and explain it.

, , No Comments

SSL Client Application Components 

At a minimum, an SSL client application comprises the following components: 

Java client 

A Java client performs these functions:

  • Initialises an SSLContextwith client identity, a HostnameVerifierJSSE, a TrustManagerJSSE, and a HandshakeCompletedListener. 
  • Creates a keystore and retrieves the private key and certificate chain. 
  • Uses an SSLSocketFactory, and 
  • Uses HTTPS connect to a JSP served by an instance of WebLogic

HostnameVerifier


The HostnameVerifier implements the weblogic.security.SSL.HostnameVerifierJSSE interface. It provides a callback mechanism so that implementers of this interface can supply a policy for handling the case where the host that is being connected the server name from the c(SubjectDN) must match. 

HandshakeCompletedListener 

The HandshakeCompletedListener implements the javax.net.ssl.HandshakeCompletedListenerinterface. It defines how the SSL client receives notifications about the completion of an SSL handshake on a given SSL connection. It also defines the number od times an SSL handshake takes place on a given SSL connection. 

TrustManager

The TrustManager implements the weblogic.security.SSL.TrustManagerJSSE interface. it builts a certificate path to a trusted root and returns true if it can be validated and is trusted for client SSL authentication.

build script (build.xml)

This script compiles all the files required for the application and deploys them to the WebLogic Server applications directories.

Sample package code for this type program


package examples.security.sslclient;

import java.io.File;
import java.net.URL;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Hashtable;
import java.security.Provider;
import javax.naming.NamingException;
import javax.naming.Context;
import javax.naming.InitialContext
import javax.servlet.ServletOutputStream;
import weblogic.net.http.*;
import weblogic.jndi.Environment;
/** SSLClient is a short example of how to use the SSL library o
* WebLogic to make outgoi
* d
* WebLogic (in a Servlet).
*
*/

>> See complete program in STUDY MATERIAL MCS051 Block 3 Page 37

0 comments:

Post a Comment

Let us know your responses and feedback