PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PSSLContext Class Reference

Context for SSL channels. More...

`#include <pssl.h>`

Inheritance diagram for PSSLContext:
[legend]
Collaboration diagram for PSSLContext:
[legend]

## Public Types
enum | Method { SSLv23, SSLv3, TLSv1 }
Public Types inherited from PObject
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
| Result of the comparison operation performed by the `Compare()` function. More...

## Public Member Functions
| PSSLContext (const void *sessionId=NULL, PINDEX idSize=0)
| Create a new context for SSL channels. More...
| PSSLContext (Method method, const void *sessionId=NULL, PINDEX idSize=0)
| ~PSSLContext ()
| Clean up the SSL context. More...
| operator ssl_ctx_st * () const
| Get the internal SSL context structure. More...
bool | SetVerifyLocations (const PFilePath &caFile, const PDirectory &caDir)
| Set the locations for CA certificates used to verify peer certificates. More...
bool | SetVerifyCertificate (const PSSLCertificate &cert)
| Set the CA certificate used to verify peer certificates. More...
| P_DECLARE_ENUM (VerifyMode, VerifyNone, VerifyPeer, VerifyPeerMandatory)
void | SetVerifyMode (VerifyMode mode, unsigned depth=9)
| Set certificate verification mode for connection. More...
VerifyMode | GetVerifyMode () const
| Set certificate verification mode for connection. More...
bool | AddClientCA (const PSSLCertificate &certificate)
| Set the CA certificate(s) to send to client from server. More...
bool | AddClientCA (const PList< PSSLCertificate > &certificates)
bool | UseCertificate (const PSSLCertificate &certificate)
| Use the certificate specified. More...
bool | UsePrivateKey (const PSSLPrivateKey &key)
| Use the private key specified. More...
bool | UseDiffieHellman (const PSSLDiffieHellman &dh)
| Use the Diffie-Hellman parameters specified. More...
bool | SetCipherList (const PString &ciphers)
| Set the available ciphers to those listed. More...
bool | SetCredentials (const PString &authority, const PString &certificate, const PString &privateKey, bool create=false)
| Set the credentials for the context. More...
void | SetPasswordNotifier (const PSSLPasswordNotifier &notifier)
| Set the notifier for when SSL needs to get a password to unlock a private key. More...
Public Member Functions inherited from PObject
unsigned | GetTraceContextIdentifier () const
| Get PTRACE context identifier. More...
void | SetTraceContextIdentifier (unsigned id)
void | GetTraceContextIdentifier (PObject &obj)
void | GetTraceContextIdentifier (PObject *obj)
void | SetTraceContextIdentifier (const PObject &obj)
void | SetTraceContextIdentifier (const PObject *obj)
virtual | ~PObject ()
virtual PObject * | Clone () const
| Create a copy of the class on the heap. More...
template<class CLS >
CLS * | CloneAs () const
| As for Clone() but converts to specified type. More...
virtual PINDEX | HashFunction () const
| This function yields a hash value required by the `PDictionary` class. More...
virtual const char * | GetClass (unsigned ancestor=0) const
| Get the current dynamic type of the object instance. More...
PBoolean | IsClass (const char *cls) const
virtual PBoolean | InternalIsDescendant (const char *clsName) const
| Determine if the dynamic type of the current instance is a descendent of the specified class. More...
__inline const PObject * | PTraceObjectInstance () const
virtual Comparison | Compare (const PObject &obj) const
| Compare the two objects and return their relative rank. More...
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const
| Determine the byte wise comparison of two objects. More...
bool | operator== (const PObject &obj) const
| Compare the two objects. More...
bool | operator!= (const PObject &obj) const
| Compare the two objects. More...
bool | operator< (const PObject &obj) const
| Compare the two objects. More...
bool | operator> (const PObject &obj) const
| Compare the two objects. More...
bool | operator<= (const PObject &obj) const
| Compare the two objects. More...
bool | operator>= (const PObject &obj) const
| Compare the two objects. More...
virtual void | PrintOn (ostream &strm) const
| Output the contents of the object to the stream. More...
virtual void | ReadFrom (istream &strm)
| Input the contents of the object from the stream. More...

## Protected Member Functions
void | Construct (Method method, const void *sessionId, PINDEX idSize)
Protected Member Functions inherited from PObject
| PObject ()
| Constructor for PObject, made protected so cannot ever create one on its own. More...

## Protected Attributes
ssl_ctx_st * | m_context
PSSLPasswordNotifier | m_passwordNotifier
Protected Attributes inherited from PObject
unsigned | m_traceContextIdentifier

## Additional Inherited Members
Static Public Member Functions inherited from PObject
static const char * | Class ()
| Get the name of the class as a C string. More...
static __inline const PObject * | PTraceObjectInstance (const char *)
static __inline const PObject * | PTraceObjectInstance (const PObject *obj)
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
| Internal function caled from CompareObjectMemoryDirect() More...
Friends inherited from PObject

## Detailed Description

Context for SSL channels.

This class embodies a common environment for all connections made via SSL using the PSSLChannel class. It includes such things as the version of SSL and certificates, CA's etc.

## Member Enumeration Documentation

enum PSSLContext::Method

Enumerator
SSLv23 |
SSLv3 |
TLSv1 |

## Constructor & Destructor Documentation

PSSLContext::PSSLContext | ( | const void * | sessionId = `NULL`,
|  | PINDEX | idSize = `0`
| ) |  |

Create a new context for SSL channels.

An optional session ID may be provided in the context. This is used to identify sessions across multiple channels in this context. The session ID is a completely arbitrary block of data. If sessionId is non NULL and idSize is zero, then sessionId is assumed to be a pointer to a C string. The default SSL method is TLSv1

Parameters

  sessionId | Pointer to session ID
  idSize | Size of session ID

PSSLContext::PSSLContext | ( | Method | method,
|  | const void * | sessionId = `NULL`,
|  | PINDEX | idSize = `0`
| ) |  |

Parameters

  method | SSL connection method
  sessionId | Pointer to session ID
  idSize | Size of session ID

PSSLContext::~PSSLContext | ( |  | ) |

Clean up the SSL context.

## Member Function Documentation

bool PSSLContext::AddClientCA | ( | const PSSLCertificate & | certificate | ) |

Set the CA certificate(s) to send to client from server.

bool PSSLContext::AddClientCA | ( | const PList< PSSLCertificate > & | certificates | ) |

void PSSLContext::Construct | ( | Method | method,
|  | const void * | sessionId,
|  | PINDEX | idSize
| ) |  |
| protected

VerifyMode PSSLContext::GetVerifyMode | ( |  | ) | const

Set certificate verification mode for connection.

PSSLContext::operator ssl_ctx_st * | ( |  | ) | const
| inline

Get the internal SSL context structure.

References m_context.

PSSLContext::P_DECLARE_ENUM | ( | VerifyMode | ,
|  | VerifyNone | ,
|  | VerifyPeer | ,
|  | VerifyPeerMandatory |
| ) |  |

bool PSSLContext::SetCipherList | ( | const PString & | ciphers | ) |

Set the available ciphers to those listed.

Parameters

  ciphers | List of cipher names.

bool PSSLContext::SetCredentials | ( | const PString & | authority,
|  | const PString & | certificate,
|  | const PString & | privateKey,
|  | bool | create = `false`
| ) |  |

Set the credentials for the context.

Parameters

  authority | Certificate Authority directory, file or data
  certificate | Local certificate file or data
  privateKey | Private key file or data for local certificate
  create | If certificate/provateKey are file paths and do not exist, then create.

void PSSLContext::SetPasswordNotifier | ( | const PSSLPasswordNotifier & | notifier | ) |

Set the notifier for when SSL needs to get a password to unlock a private key.

Parameters

  notifier | Notifier to be called

bool PSSLContext::SetVerifyCertificate | ( | const PSSLCertificate & | cert | ) |

Set the CA certificate used to verify peer certificates.

bool PSSLContext::SetVerifyLocations | ( | const PFilePath & | caFile,
|  | const PDirectory & | caDir
| ) |  |

Set the locations for CA certificates used to verify peer certificates.

Parameters

  caFile | File for CA certificates
  caDir | Directory for CA certificates

void PSSLContext::SetVerifyMode | ( | VerifyMode | mode,
|  | unsigned | depth = `9`
| ) |  |

Set certificate verification mode for connection.

Parameters

  mode | New verification mode
  depth | Verification depth (max number of certs in chain)

bool PSSLContext::UseCertificate | ( | const PSSLCertificate & | certificate | ) |

Use the certificate specified.

bool PSSLContext::UseDiffieHellman | ( | const PSSLDiffieHellman & | dh | ) |

Use the Diffie-Hellman parameters specified.

bool PSSLContext::UsePrivateKey | ( | const PSSLPrivateKey & | key | ) |

Use the private key specified.

## Member Data Documentation

ssl_ctx_st* PSSLContext::m_context
| protected

Referenced by operator ssl_ctx_st *().

PSSLPasswordNotifier PSSLContext::m_passwordNotifier
| protected

The documentation for this class was generated from the following file:

- pssl.h