Java SSL tutorial

Java SSL tutorial Print E-mail
User Rating: / 28
PoorBest 
Contributed by Howell   
Saturday, 17 June 2006

Abstract of TM Secure Socket Extension (JSSE)(Java SSL tutorial)

The Java Secure Socket Extension (JSSE) is a set of Java packages that enable secure Internet communications. It implements a Java version of SSL (Secure Sockets Layer) and TLS (Transport Layer Security) protocols and includes functionality for data encryption, server authentication, message integrity, and optional client authentication. Using JSSE, developers can provide for the secure passage of data between a client and a server running any application protocol (such as HTTP, Telnet, NNTP, and FTP) over TCP/IP. 

Important Features
  • Pure Java implementation
  • Exportable from the United States
  • Secure Sockets Layer (SSL) v3 support
  • Transport Layer Security (TLS) 1.0 support
  • Basic utilities for key and certificate management, including securely encrypted storage of private keys and Certificate Authority (CA) support
  • SSLSocket and SSLServerSocket classes, which can be instantiated to create secure channels
  • Cipher Suite negotiation, which performs SSL "handshaking" to initiate or verify secure communications
  • Client and server authentication, as a part of the normal SSL handshaking
  • HTTPS support: the ability to access data such as HTML pages using HTTPS
  • Server Session Management to manage the cache of sessions.
  • RSA cryptography algorithms -- the JSSE implementation includes code licensed from RSA Data Security.
  • Cryptographic suites, including:

 

An example of creating an SSL Client Socket(Java SSL tutorial)

 try {
        int port = 225;
        String hostname = "hotdir.biz";
        SocketFactory socketFactory = SSLSocketFactory.getDefault();
        Socket socket = socketFactory.createSocket(hostname, port);

        InputStream in = socket.getInputStream();
        OutputStream out = socket.getOutputStream();
        in.close();
        out.close();
    } catch(IOException e) {
    }

 Creating an SSL Server Socket(Java SSL tutorial)

try {
        int port = 225;
        ServerSocketFactory ssocketFactory = SSLServerSocketFactory.getDefault();
        ServerSocket ssocket = ssocketFactory.createServerSocket(port);
   
        Socket socket = ssocket.accept();
        InputStream in = socket.getInputStream();
        OutputStream out = socket.getOutputStream();

        in.close();
        out.close();
    } catch(IOException e) {
    }


Use HTTPS in your Java client code  (From javaworld)

 Abstract

 Using HTTPS (Hypertext Transfer Protocol Secure) isn't as obvious as you might think. If you've ever tried to implement secure communication between a Java client and an HTTPS server, you've probably discovered that the standard java.net.URL class doesn't support the HTTPS protocol. This tip shows you how to overcome that limitation, using a JDK 1.2-compatible virtual machine or Microsoft's JDK 1.1-compatible JView.

 

Last Updated ( Thursday, 06 July 2006 )

  home              contact us

 

©2006-2014 DeveloperZone.biz   All rights reserved     powered by Mambo Designed by Siteground