Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Java : Education - Tutorials
Using JSSE for secure socket communication
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
5. Using JSSE sockets
  


Connection setup page 3 of 11


To initiate a secure socket connection to a remote server, we must carry out the following steps:

  1. Create a SecureRandom, a source of secure random numbers. Secure random numbers are numbers that are random enough that they will not make the encryption vulnerable to attack.

  2. Create a KeyStore object containing the remote server's public key. This is read from server.public.

  3. Create a KeyStore object containing the client's public/private key pair, including its public key certificate. This is read from client.private.

  4. Create a TrustManagerFactory from the remote server's KeyStore. This is used to authenticate the remote server.

  5. Create a KeyManagerFactory from the client's KeyStore. This is used for encrypting and decrypting data.

  6. Create an SSLContext object, using the KeyManagerFactory, the TrustManagerFactory, and the SecureRandom.

  7. Use the SSLContext to create an SSLSocketFactory.

  8. Use the SSLSocketFactory to create an SSLSocket, which acts just like a regular Socket, except that it is secure.

Main menuSection menuFeedbackPreviousNext
Privacy Legal Contact