SourcePro : Secure Communication Module User’s Guide : PART II Secure Sockets Package : Advanced Topics : Mixing Calls to the Secure Sockets Package with Calls to the Cryptographic Library
Mixing Calls to the Secure Sockets Package with Calls to the Cryptographic Library
The Secure Sockets package enables your application to access data structures of the cryptographic library through the getRep() method. The following table lists the classes that include getRep(), along with the corresponding data structure.
Class Name
Underlying Type
EVP_PKEY*
X509*
SSL_CTX*
SSL*
SSL_SESSION*
SSL_METHOD* (automatic conversion)
To access the SSL* structure underlying an RWSecureSocketPortal, you can do either of the following:
*Obtain a reference to the RWSecureSocket underlying the portal, then invoke getRep(). RWSecureSocketMethod provides an automatic conversion operator from RWSecureSocketMethod to an SSL_METHOD*.
*Use this statement in your code:
 
SSL*s = portal.getSocket().getRep();
When using the pointers returned by getRep(), you must consider the lifetimes of the objects in the Secure Sockets package. When one of these objects goes out of scope and is destroyed, the pointer is no longer valid. Be sure that these objects do not go out of scope while your application holds a low-level pointer.
Classes RWSecureSocketPortal, RWSecureSocketContext, RWAsymmetricKey, RWX509Certificate, and RWSecureSocketSession are all implemented using the handle-body idiom. This means that their representations are reference-counted. They are destroyed when all handles referring to their representations are destroyed.