HTTP and SSL

   

Troubleshooting Tip

If you are trying to get an HTTPS connection using Java and are having trouble, see "Can't Get HTTPS Connection" in the "Troubleshooting" section at the end of this chapter.


SSL is a protocol that runs on top of a TCP/IP connection. When a client Socket attempts to make a connection with a server socket that is listening on a secure port, such as the standard SSL port 443, there is some extra communication that takes place between the server and the client. The main thing that is decided between the two sides is how they are going to encrypt the data that is sent back and forth between them. This is not always successful, because the two sides can support various algorithms and they might not have an algorithm in common and therefore are unable to communicate with one another. When they do have an algorithm in common, the rest of the communication is basically the same.

From the Java programmer's viewpoint, it's pretty easy. There is some setup involved to communicate on a port other than the default 80, but basically, after a SSL communication is established, it's like any other stream that a client can write to.

There are various ways to communicate via HTTPS with the core Java API, but it becomes a headache to get all of it set up for this. Fortunately, Sun has introduced the Java Secure Socket Extensions. It's not part of the core API, but it will be probably in the next release. You have to download it separately, but after you have it, things get pretty easy. You can get the latest version at

 http://developer.java.sun.com/developer/earlyAccess/jsse/index.html 

Note

To download the JSSE, you will have to become a member of the Java Developer Connection. It's free to join and this will also give you access to beta products earlier than the standard site will release them.


   


Special Edition Using Java 2 Standard Edition
Special Edition Using Java 2, Standard Edition (Special Edition Using...)
ISBN: 0789724685
EAN: 2147483647
Year: 1999
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net