Java Tip 96: Use HTTPS in your Java client code; Find out how to use the HTTPS protocol with the standard URL class

f you've ever tried to implement secure communication between a Java client and an HTTPS (HyperText Transfer Protocol Secure) server, you've probably discovered that the standard java.net.URL class doesn't support the HTTPS protocol. The server-side implementation of that equation is...

Celý popis

Uloženo v:
Podrobná bibliografie
Vydáno v:Java world s. 1
Hlavní autor: Towers, Matt
Médium: Magazine Article
Jazyk:angličtina
Vydáno: San Francisco Foundry 16.06.2000
ISSN:1091-8906, 1091-8906
On-line přístup:Získat plný text
Tagy: Přidat tag
Žádné tagy, Buďte první, kdo vytvoří štítek k tomuto záznamu!
Popis
Shrnutí:f you've ever tried to implement secure communication between a Java client and an HTTPS (HyperText Transfer Protocol Secure) server, you've probably discovered that the standard java.net.URL class doesn't support the HTTPS protocol. The server-side implementation of that equation is fairly straightforward. Almost any Web server available today provides a mechanism for requesting data, using HTTPS. Once you have your Web server set up, any browser can request secure information from your server simply by specifying HTTPS as the protocol for the URL. If you don't already have an HTTPS server set up, you can test your client code with almost any HTTPS Webpage on the Internet. The Resources section contains a short list of candidates that you can use for that purpose. Fortunately, to accommodate that constraint, the Java specification provides for the ability to select an alternate stream handler for the URL class. However, the technique required to implement that is different, depending on the virtual machine (VM) you use. For Microsoft's JDK 1.1-compatible VM, JView, Microsoft has licensed the algorithm and provided an HTTPS stream handler as part of its wininet package. Sun, on the other hand, has recently released the Java Secure Sockets Extension (JSSE) for JDK 1.2-compatible VMs, in which Sun has also licensed and provided an HTTPS stream handler. This article will demonstrate how to implement the use of an HTTPS- enabled stream handler, using the JSSE and Microsoft's wininet package. Performing HTTPS-based communication from within an applet seems like a natural extension of scenarios described above. In reality, it's even easier in most cases. In 4.0 and later versions of Netscape Navigator and Internet Explorer, HTTPS is enabled by default for their respective VMs. Therefore, if you want to create an HTTPS connection from within your applet code, simply specify HTTPS as your protocol when creating an instance of the URL class:
ISSN:1091-8906
1091-8906