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

RWSecureSocketContext

Module:  Secure Communication Module   Package:  Secure Sockets


RWSecureSocketContextRWHandleBase

Local Index

Members

Header File

#include <rw/secsock/RWSecureSocketContext.h>

Description

RWSecureSocketContext represents an SSL/TLS context. It is an adapter for the underlying cryptographic library's representation of a secure socket context. The context contains the default settings for all secure sockets created by using this class. RWSecureSocketContext also maintains the session cache. The defaults set with this class may be overridden on a per-connection basis.

Every application using the Secure Sockets package must create at least one instance of RWSecureSocketContext and then initialize it with setIdentity() and/or prepareToAuthenticate(). In general, server programs use setIdentity(), and clients use prepareToAuthenticate(). If an application requires both client and server authentication, both the client and the server call both functions. For more information, see the Secure Communication Module User's Guide.

The constructor for RWSecureSocketContext throws an RWSecureSocketRNGNotSeededError exception unless one of the Secure Sockets package random number generator seeding functions or constructors was used before the construction of the RWSecureSocketContext.

RWSecureSocketContext uses the handle-body idiom handle memory management for the cryptographic library. This implementation also ensures that the body and the associated memory are not destroyed until all handles to that body are destroyed.


NOTE -- For a full discussion of the handle-body idiom, see Section 7.3.1, "Understanding the Handle-Body Idiom," in the Threads Module User's Guide.

Enum

enum RWSSLShutdownMode { RW_SSL_SHUTDOWN_NORMAL,
                         RW_SSL_SHUTDOWN_QUIET };

Typedefs

typedef SSL_CTX* RWSecureSocketContextRep;
extern "C" typedef int(*RWPasswordCallback)(char*, int, int);
extern "C" typedef int (*RWClientCertificateCallback)
                        (SSL*, X509**, EVP_PKEY **);
extern "C" typedef int (*RWVerifyCallback)(int,
X509_STORE_CTX*);

Public Constructor

RWSecureSocketContext(const RWSecureSocketContext& second);
RWSecureSocketContext(const RWSecureSocketMethod& 
           method = RWSecureSocketMethod::TLSv1WithFallback);

NOTE -- Calls setOptions(SSL_OP_ALL) to enable all known compatibility flags. See the description of the setOptions() function for more information.

Destructor

~RWSecureSocketContext();

Public Operator

RWSecureSocketContext&
operator=(RWSecureSocketContext& second);

Public Member Functions

bool
checkPrivateKey() const;
RWClientCertificateCallback
getClientCertificateCallback() const;
RWVerifyCallback
getCertificateVerifyCallback() const;
int
getCertificateVerifyMode() const;
RWSecureSocketContextRep
getRep() const;

NOTE -- The memory that this pointer references is owned by the body class, RWSecureSocketContextImp, so users should not attempt to delete it. RWSecureSocketContextImp deletes the memory when all handles referring to that body are destroyed.
RWSSLShutdownMode 
getShutdownMode() const;
void
loadVerifyLocations(const RWCString& file);
void 
prepareToAuthenticate(const RWCString& trustedCertsFile );
void
setCertificate(const RWX509Certificate& cert);

NOTE -- If the setCertificate() function is called before setPrivateKey(), the cryptographic library automatically compares the key and the certificate. If the key does not match the certificate, setPrivateKey() throws RWSecureSocketUsePrivateKeyError. This exception is not thrown if setPrivateKey() is called before setCertificate(), even if the key does not match the certificate. In any case, if the key does not match the certificate, checkPrivateKey() will return false.
void
setCertificateVerifyCallback(RWVerifyCallback fun);
void
setCertificateVerifyMode(int mode);
void
setCipherList(const RWCString& list);
void
setClientCertificateCallback(RWClientCertificateCallback fun);
void 
setIdentity(const RWX509Certificate& cert, 
            const RWPrivateKey& pkey);
void
setOptions(long op);
void
setPrivateKey(const RWPrivateKey& pkey );

NOTE -- If the setCertificate() function is called before setPrivateKey(), the cryptographic library automatically compares the key and the certificate. If the key does not match the certificate, setPrivateKey() throws RWSecureSocketUsePrivateKeyError. This exception is not thrown if setPrivateKey() is called before setCertificate(), even if the key does not match the certificate. In any case, if the key does not match the certificate, checkPrivateKey() returns false.
void
setShutdownMode(RWSSLShutdownMode mode);

NOTE -- Security issues related to this function are described in the Security Issues section of the Secure Communication Module User's Guide.
setVerify(int mode, RWVerifyCallback fun);

Protected Member Function

RWSecureSocketContextImp&
body() const;


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.