PTLib
Version 2.18.8
|
Context for SSL channels. More...
#include <pssl.h>
Public Member Functions | |
P_DECLARE_TRACED_ENUM (Method, SSLv23, SSLv3, TLSv1, TLSv1_1, TLSv1_2, DTLSv1, DTLSv1_2, DTLSv1_2_v1_0) | |
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 | SetVerifyDirectory (const PDirectory &caDir) |
Set the locations for CA certificates used to verify peer certificates. More... | |
bool | SetVerifyFile (const PFilePath &caFile) |
Set the locations for CA certificates used to verify peer certificates. More... | |
bool | SetVerifySystemDefault () |
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 ¬ifier) |
Set the notifier for when SSL needs to get a password to unlock a private key. More... | |
bool | SetExtension (const char *extension) |
Set TLS extension. More... | |
Method | GetMethod () const |
![]() | |
__inline unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
__inline void | SetTraceContextIdentifier (unsigned id) |
__inline void | SetTraceContextIdentifier (const PObject &obj) |
__inline void | SetTraceContextIdentifier (const PObject *obj) |
__inline void | CopyTraceContextIdentifier (PObject &obj) const |
__inline void | CopyTraceContextIdentifier (PObject *obj) const |
virtual | ~PObject () |
__inline const char * | GetClass () const |
__inline bool | IsClass (const char *name) const |
__inline const PObject * | PTraceObjectInstance () const |
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 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... | |
Static Public Attributes | |
static const Method | HighestTLS = TLSv1_2 |
static const Method | HighestDTLS = DTLSv1_2_v1_0 |
Protected Member Functions | |
void | Construct (const void *sessionId, PINDEX idSize) |
![]() | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. More... | |
Protected Attributes | |
Method | m_method |
ssl_ctx_st * | m_context |
PSSLPasswordNotifier | m_passwordNotifier |
![]() | |
unsigned | m_traceContextIdentifier |
Additional Inherited Members | |
![]() | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
![]() | |
static __inline void | CopyTraceContextIdentifier (PObject &to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject &to, const PObject *from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject *from) |
static __inline const char * | Class () |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
template<typename T > | |
static Comparison | Compare2 (T v1, T v2) |
Compare two types, returning Comparison type. More... | |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
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.
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
sessionId | Pointer to session ID |
idSize | Size of session ID |
PSSLContext::PSSLContext | ( | Method | method, |
const void * | sessionId = NULL , |
||
PINDEX | idSize = 0 |
||
) |
method | SSL connection method |
sessionId | Pointer to session ID |
idSize | Size of session ID |
PSSLContext::~PSSLContext | ( | ) |
Clean up the SSL context.
bool PSSLContext::AddClientCA | ( | const PSSLCertificate & | certificate | ) |
Set the CA certificate(s) to send to client from server.
bool PSSLContext::AddClientCA | ( | const PList< PSSLCertificate > & | certificates | ) |
|
protected |
|
inline |
References m_method.
VerifyMode PSSLContext::GetVerifyMode | ( | ) | const |
Set certificate verification mode for connection.
|
inline |
Get the internal SSL context structure.
References m_context.
PSSLContext::P_DECLARE_ENUM | ( | VerifyMode | , |
VerifyNone | , | ||
VerifyPeer | , | ||
VerifyPeerMandatory | |||
) |
PSSLContext::P_DECLARE_TRACED_ENUM | ( | Method | , |
SSLv23 | , | ||
SSLv3 | , | ||
TLSv1 | , | ||
TLSv1_1 | , | ||
TLSv1_2 | , | ||
DTLSv1 | , | ||
DTLSv1_2 | , | ||
DTLSv1_2_v1_0 | |||
) |
bool PSSLContext::SetCipherList | ( | const PString & | ciphers | ) |
Set the available ciphers to those listed.
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.
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. |
bool PSSLContext::SetExtension | ( | const char * | extension | ) |
Set TLS extension.
void PSSLContext::SetPasswordNotifier | ( | const PSSLPasswordNotifier & | notifier | ) |
Set the notifier for when SSL needs to get a password to unlock a private key.
notifier | Notifier to be called |
bool PSSLContext::SetVerifyCertificate | ( | const PSSLCertificate & | cert | ) |
Set the CA certificate used to verify peer certificates.
bool PSSLContext::SetVerifyDirectory | ( | const PDirectory & | caDir | ) |
Set the locations for CA certificates used to verify peer certificates.
caDir | Directory for CA certificates |
bool PSSLContext::SetVerifyFile | ( | const PFilePath & | caFile | ) |
Set the locations for CA certificates used to verify peer certificates.
caFile | File for CA certificates |
bool PSSLContext::SetVerifyLocations | ( | const PFilePath & | caFile, |
const PDirectory & | caDir | ||
) |
Set the locations for CA certificates used to verify peer certificates.
caFile | File for CA certificates |
caDir | Directory for CA certificates |
void PSSLContext::SetVerifyMode | ( | VerifyMode | mode, |
unsigned | depth = 9 |
||
) |
Set certificate verification mode for connection.
mode | New verification mode |
depth | Verification depth (max number of certs in chain) |
bool PSSLContext::SetVerifySystemDefault | ( | ) |
Set the locations for CA certificates used to verify peer certificates.
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.
|
static |
|
static |
|
protected |
Referenced by operator ssl_ctx_st *().
|
protected |
Referenced by GetMethod().
|
protected |