My Project
Loading...
Searching...
No Matches
wolfssl.SSLContext Class Reference
Inheritance diagram for wolfssl.SSLContext:

Public Member Functions

 __init__ (self, protocol, server_side=False)
 
 __del__ (self)
 
 verify_mode (self)
 
 verify_mode (self, value)
 
 wrap_socket (self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True)
 
 set_ciphers (self, ciphers)
 
 load_cert_chain (self, certfile, keyfile=None, password=None)
 
 load_verify_locations (self, cafile=None, capath=None, cadata=None)
 

Data Fields

 protocol = protocol
 
 native_object = _lib.wolfSSL_CTX_new(method.native_object)
 
 verify_mode = CERT_NONE
 

Protected Attributes

 _side = server_side
 
 _verify_mode = None
 

Detailed Description

An SSLContext holds various SSL-related configuration options and
data, such as certificates and possibly a private key.

Member Function Documentation

◆ load_cert_chain()

wolfssl.SSLContext.load_cert_chain ( self,
certfile,
keyfile = None,
password = None )
Load a private key and the corresponding certificate. The certfile
string must be the path to a single file in PEM format containing
the certificate as well as any number of CA certificates needed to
establish the certificate's authenticity.

The keyfile string, if present, must point to a file containing the
private key in.

The password parameter is not supported yet.

◆ load_verify_locations()

wolfssl.SSLContext.load_verify_locations ( self,
cafile = None,
capath = None,
cadata = None )
Load a set of "certification authority" (CA) certificates used to
validate other peers' certificates when verify_mode is other than
CERT_NONE. At least one of cafile or capath must be specified.

The cafile string, if present, is the path to a file of concatenated
CA certificates in PEM format.

The capath string, if present, is the path to a directory containing
several CA certificates in PEM format.

◆ set_ciphers()

wolfssl.SSLContext.set_ciphers ( self,
ciphers )
Set the available ciphers for sockets created with this context. It
should be a string in the wolfSSL cipher list format. If no cipher can
be selected (because compile-time options or other configuration forbids
use of all the specified ciphers), an SSLError will be raised.

◆ verify_mode()

wolfssl.SSLContext.verify_mode ( self)
Whether to try to verify other peers’ certificates and how to behave
if verification fails. This attribute must be one of CERT_NONE,
CERT_OPTIONAL or CERT_REQUIRED.

◆ wrap_socket()

wolfssl.SSLContext.wrap_socket ( self,
sock,
server_side = False,
do_handshake_on_connect = True,
suppress_ragged_eofs = True )
Wrap an existing Python socket sock and return an SSLSocket object.
sock must be a SOCK_STREAM socket; other socket types are unsupported.

The returned SSL socket is tied to the context, its settings and
certificates. The parameters server_side, do_handshake_on_connect and
suppress_ragged_eofs have the same meaning as in the top-level
wrap_socket() function.