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

Member Function Documentation

◆ addCACertificate()

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.

◆ setIdentity()

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.

◆ addCertificate()

void addCertificate ( const Certificate cert)

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