This section explains how to write new applications and how to port existing applications.
In general, to write new secure applications, you must:
Obtain certificates and keys for your application. See Section 4.3, "Obtaining Certificates."
Initialize the Winsock library, if you are using Windows, by calling the RWWinSockInfo constructor (see the SourcePro C++ API Reference Guide).
Initialize the Secure Sockets package and seed the random number generator (if necessary). See Section 4.4, "Initializing the Secure Sockets Package."
Create an instance of class RWSecureSocketContext. See Section 4.5, "Creating the Secure Socket Context." Initialize the context using the setIdentity() function for a server, or the prepareToAuthenticate() function for a client.
To use both client and server authentication, call both functions. See Section 4.5.2, "Initializing the Context to Perform Both Client and Server Authentication."
Construct a certificate, if you are writing a server application. See Section 4.6, "Constructing a Certificate," and Section 4.7, "Checking the Validity of a Certificate."
Create an RWInetAddr to bind or connect to.
Construct an RWSecureSocket, RWSecureSocketPortal, or RWSecureSocketListener using the context and address created in step 6. See Section 4.8, "Using RWSecureSocket, RWSecureSocketPortal, and RWSecureSocketListener."
Write an application that sends and receives secure messages.
SSL/TLS is defined to work only over TCP/IP sockets. UDP sockets cannot be used with SSL/TLS.
To port existing Networking package applications to the Secure Sockets package, follow these steps:
Obtain certificates and keys for your application. See Section 4.3, "Obtaining Certificates."
Initialize the Secure Sockets package and seed the random number generator (if necessary). See Section 4.4, "Initializing the Secure Sockets Package."
Create an RWSecureSocketContext. See Section 4.5, "Creating the Secure Socket Context." Initialize the context using the setIdentity() function for a server, or the prepareToAuthenticate() function for a client.
To use both client and server authentication, call both functions. See Section 4.5.2, "Initializing the Context to Perform Both Client and Server Authentication."
Construct a certificate, if you are writing a server application. See Section 4.6, "Constructing a Certificate," and Section 4.7, "Checking the Validity of a Certificate."
Modify class names:
RWSocketListener to RWSecureSocketListener
Associate the RWSecureSocketContext with a socket, a portal, or a listener. Use either the constructor, the connect() method, the bind() method, the accept() method, or the setContext() method.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.