0% found this document useful (0 votes)
3 views

Lecture 7 - Python TLS Libraries and the TLS Context_Handouts

The document outlines the integration and functionality of TLS libraries in Python, detailing the responsibilities of various layers such as IP, TCP, and TLS modules. It explains the purpose of the TLS Context in managing configurations for secure communications and provides guidance on creating a TLS context using helper functions. Additionally, it mentions upcoming tutorials and laboratory tasks related to securing a web server and working with certificates.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lecture 7 - Python TLS Libraries and the TLS Context_Handouts

The document outlines the integration and functionality of TLS libraries in Python, detailing the responsibilities of various layers such as IP, TCP, and TLS modules. It explains the purpose of the TLS Context in managing configurations for secure communications and provides guidance on creating a TLS context using helper functions. Additionally, it mentions upcoming tutorials and laboratory tasks related to securing a web server and working with certificates.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Python TLS Libraries and

the TLS Context

© 2024 Swinburne University of Technology 1

7.1 TLS Library Integration –


How it Works

© 2024 Swinburne University of Technology 2


TLS Integration
Details
Responsibilites
• IP Layer – handles getting packets to
destination
• TCP Layer – handles connection and
handshake
• TLS Modules – handles TLS handshake,
certificate verification, choosing
keys/algorithm, and encryption
• Application – Sends/receives
unencrypted data

Lets have a look on the whiteboard

© 2024 Swinburne University of Technology 3

7.2 TLS Libraries

© 2024 Swinburne University of Technology 4


Python – TLS Libraries
Loading the Libraries

Both the Socket and TLS Libraries are standard for Python

• TLS will only work if openssl is installed on Linux


• Should work as-is on Windows/Mac
• Socket Library uses Socket class
• TLS Library uses SSLSocket class
• SSLSocket wraps the Socket class

import socket
import ssl
© 2024 Swinburne University of Technology 5

7.3 The TLS Context

© 2024 Swinburne University of Technology 6


TLS Context
What is the Purpose of the TLS Context

TLS Context manages TLS


configurations
• New Connections
• Multiple Connections
• Allows you to specify application-wide
settings for all secure communications

Wrapping the Socket


• You cannot just create an SSLSocket
1. Create Context
2. Create Socket
3. Wrap Socket with Context to create
an SSLSocket

© 2024 Swinburne University of Technology 7

TLS Context
Creating the Context

Don’t try to create the context directly


• Library provides helper functions
• Use create_default_context()

First Parameter – Specify TLS Purpose


• Are you acting as a server or client

Other Parameter – Certificate


• Specify certificate verification settings

© 2024 Swinburne University of Technology 8


7.4 Tutorial and Laboratory

© 2024 Swinburne University of Technology 9

Week 7
Tutorial – Test 1

Canvas Test
• Bring your own Devices
• Covers Lectures weeks 1-5
• Graded Test within your Portfolio

© 2024 Swinburne University of Technology 10


Week 7
Lab – Securing a Web Server

In this lab, you will complete the following objectives:


• Extend your work on building a secure HTTP web site
• Create a HTTP site with a certificate that is signed by a central Certificate Authority
• Retrieve the encrypted website
Credit Task:
• Repeat the process but using a certificate chain with an Intermediate Authority

© 2024 Swinburne University of Technology 11

You might also like