Secure Communication Module User’s Guide : PART III HTTPS Package : Chapter 7 Using HTTPS : Developing HTTPS Applications
Developing HTTPS Applications
The following steps describe how to write an HTTPS application. They are similar to writing an HTTP application, and step 1 through step 3 are identical to writing an application that uses secure sockets.
1. Initialize the Winsock library, if you are using Windows, by calling the RWWinSockInfo constructor (see the SourcePro Reference Guide).
2. Initialize the Secure Sockets package and seed the random number generator, if necessary. See “Initializing the Secure Sockets Package.”
3. Create an instance of class RWSecureSocketContext. See “Creating the Secure Socket Context.” Initialize the context using the setIdentity() function for a server, or the prepareToAuthenticate() function for a client.
4. Decide whether to use the agent class or the client class.
For simple requests, use the agent class.
For more control over the HTTP protocol, use the client class.
5. Associate the secure socket context created in step 3 with your chosen HTTPS class.
For the agent class, call RWHttpsSecurityManager::setAgentContext(context).
For the client class, create an instance of RWHttpsSecureSocketClient by calling the static make() function and pass the context to it.
6. Write a certificate name mismatch callback (see “Supplying Your Own Callbacks”). It is not strictly required, but the default behavior (throwing an exception) may not be acceptable for your application.
7. Continue developing your HTTPS application just as you would an HTTP application. See Chapter 5, “The HTTP Package,” in the Internet Protocols Module User’s Guide.