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

8.1 Supplying Your Own Callbacks

This section explains how to write your own certificate name check callback and certificate name mismatch callback, as mentioned in Section 7.4, "Using the Security Callbacks."

Callbacks are implemented using functors. See Chapter 8, "The Functor Package," in the Threads Module User's Guide for more information.

8.1.1 Writing a Callback

As you write the callback functions, keep the required function signatures in mind. You can add additional parameters as callee data as described in Chapter 8, "The Functor Package," in the Threads Module User's Guide.

Rogue Wave does not provide technical support for writing callbacks. The functions in the HTTPS package that set the callback are provided for convenience only.

To use your callback, you will:

  1. Create an appropriate functor that wraps your function and passes in any necessary data. For example, you could pass in a handle to your windowing system to pop up a message box from the callback.

  2. Call either RWHttpsSecurityManager::setNameCheckCallback() or RWHttpsSecurityManager::setNameMismatchCallback() and pass your functor as the argument.

    A certificate name check callback must return true if the name in the server's certificate is the same as the name of the host, and false if the names are different.

Example 12 adds callback functions to Example 10. (See Section 7.1, "Getting Started with HTTPS.")

This example uses utility functions provided in util.h.

Example 12: Supplying a Callback


Creates the name Check Callback functor.


Directs the HTTPS package to use this functor as the name Check Callback.


Creates the Name Mismatch Callback.


Directs the HTTPS package to use this functor as the name Mismatch Callback.

8.1.2 Switching to the Default Callback

To stop using your callback, call one of these set functions:

Example 13: Switching to the Default Callback

Previous fileTop of DocumentContentsNo linkNext file

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.