Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _resume_ssl_session(self, target, sslSession=None, tlsTicket=False):
"""
Connect to the server and returns the session object that was assigned
for that connection.
If ssl_session is given, tries to resume that session.
"""
sslConn = create_sslyze_connection(target, self._shared_settings)
if not tlsTicket:
# Need to disable TLS tickets to test session IDs, according to rfc5077:
# If a ticket is presented by the client, the server MUST NOT attempt
# to use the Session ID in the ClientHello for stateful session resumption
sslConn.set_options(SSL_OP_NO_TICKET) # Turning off TLS tickets.
if sslSession:
sslConn.set_session(sslSession)
try: # Perform the SSL handshake
sslConn.connect()
newSession = sslConn.get_session() # Get session data
finally:
sslConn.close()
return newSession
def _resume_ssl_session(self, target, sslSession=None, tlsTicket=False):
"""
Connect to the server and returns the session object that was assigned
for that connection.
If ssl_session is given, tries to resume that session.
"""
sslConn = create_sslyze_connection(target, self._shared_settings)
if not tlsTicket:
# Need to disable TLS tickets to test session IDs, according to rfc5077:
# If a ticket is presented by the client, the server MUST NOT attempt
# to use the Session ID in the ClientHello for stateful session resumption
sslConn.set_options(SSL_OP_NO_TICKET) # Turning off TLS tickets.
if sslSession:
sslConn.set_session(sslSession)
try: # Perform the SSL handshake
sslConn.connect()
newSession = sslConn.get_session() # Get session data
finally:
sslConn.close()
return newSession