def get_ssl_context(self, protocol=None):
"""
This method returns a SSL context based on the file that was specified
when this object was created.
Arguments:
- An optional protocol. SSLv2 is used by default.
Returns:
- The SSL context
"""
# Validate the arguments
if protocol is None:
protocol = ssl.PROTOCOL_SSLv2
# Create an SSL context from the stored file and password.
ssl_context = ssl.SSLContext(protocol)
ssl_context.load_cert_chain(self._cert_filename,
password=self._password)
# Return the context
return ssl_context
评论列表
文章目录