Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Secure Communication Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.7 Implementing Both Client and Server Authentication

The following examples demonstrate a client and server that perform both client and server authentication using Portal Layer classes. These examples are in examples\secsock\manual\ClientServerAuthenticationClient.cpp and examples\secsock\manual\ClientServerAuthenticationServer.cpp.

These examples are identical to the RWSecureSocketPortal client and server examples in Section 4.1, "Getting Started with Secure Sockets," except for context initialization.

The examples in this chapter depend on the macros TRUSTED_CERTS_FILE, SERVER_PORT, SERVER_NAME, CLIENT_CERT_FILE, and CLIENT_PRIVATE_KEY_FILE, which are defined in examples\secsock\secsockexampledefs.h. Several of the examples use these macros to determine certificates, servers, and ports.

5.7.1 Client Example

Comments are included only for the lines that differ from the previous examples.

This example uses utility functions provided in util.h.

Example 7: Writing a client program that performs client and server authentication

//1Open the PEM file that contains the client's certificate, and create the certificate object.
//2Open the PEM file that contains the client's private key, and create the key object.
//3Set up the context so that it authenticates the server using the certificates trusted by the client.
//4Establish the identity of this client so that the server can verify its identity.

5.7.2 Server Example

Comments are included only for the lines that differ from the previous examples.

This example uses utility functions provided in util.h.

Example 8: Writing a server program that performs client and server authentication

//1Open the PEM file that contains the server's certificate, and create the certificate object.
//2Open the PEM file that contains the server's private key, and create the key object.
//3Set up the context so that it authenticates the client using the certificates trusted by the server.
//4Establish the identity of this server so the client can verify its identity.


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.