Context Class Reference

#include <Pt/Ssl/Context.h>

Context for SSL connections.

Inherits NonCopyable.

Public Member Functions

 Context ()
 Construct with defaults.
 Context (Protocol protocol)
 Construct with specific protocol.
 ~Context ()
void addCACertificate (const Certificate &trustedCert)
 Add a certificate to the trusted CA certificates. More...
void addCertificate (const Certificate &cert)
 Builds certificate chain. More...
void assign (const Context &ctx)
 Assigns the certificates, verify mode and protocol.
Protocol protocol () const
 Returns the current protocol.
void setIdentity (const Certificate &cert)
 Set the main certificate of this context. More...
void setProtocol (Protocol protocol)
 Sets the current protocol.
void setVerifyDepth (int n)
 Limits the number of certificates checked in the peer's certificate chain.
void setVerifyMode (VerifyMode mode)
 Sets the current validation mode.
VerifyMode verifyMode () const
 Returns the current verify mode.

Member Function Documentation

void addCACertificate ( const Certificate trustedCert)

Trusted CA certificates are needed to check, if the peer's certificate is signed by a trusted Certificate Authority. Add the certificates of all trusted CAs.

void setIdentity ( const Certificate cert)

Setting a main certificate is mandatory for a server context. For a client context, it is only needed for client authentication.

void addCertificate ( const Certificate cert)

Adds the certificate to the certificate chain presented to the peer together with the main certificate.