Lecture 6 - Secure Communications in Practice_Handouts
Lecture 6 - Secure Communications in Practice_Handouts
in Practice
Internet Layer
• Implemented within the OS
• Manages getting packets from
PC to PC
Transport Layer
• Implemented within the OS
• Manages getting data from
application to application
Application Layer
• Implemented by programmer
• Handles messaging
© 2024 Swinburne University of Technology 3
TCP in practice:
Data enters pipe at one end – comes out the other end in the same
order with nothing missing
© 2024 Swinburne University of Technology 4
Open Standards
Sockets API – Interfacing with the OS
Network Programming
Basic Socket API Functions (establishment)
socket()
• Create a socket in OS and return a handle to
newly created socket
bind()
• Attach socket to nominated IP address and Port
number on host
listen()
• Tell the OS to start accepting connections on
this TCP socket
accept()
• Accept a pending connection on a TCP listening socket
• Call will block until there is a connection pending as complete by the OS
connect()
• Attempt to establish a connection to a remote application
close()
• Closes the socket so no more data can be sent/received
© 2024 Swinburne University of Technology 6
Network Programming
Basic Socket API Functions (data transfer)
send()
• Send data over connected socket
• Blocks if no buffer space left
sendto()
• For unconnected UDP sockets to send to nominated remote IP
address and Port number
recv()
• Retrieve data from connected socket
• Blocks if no data available within OS
recvfrom()
• For unconnected UDP sockets, retrieve UDP datagram AND
provide information on the remote IP address and port
number so you can send a reply
TLS Support
Programmer View
Library provides a modules that sits
between the application and the
Sockets API:
• Validates Certificates
• Establishes session
• Selects encryption algorithms and keys
• Encrypts data
Embedded Systems
Network Programming from TNE20003
Not all embedded systems are
capable of supporting Python
In this case you may need to use the
C Sockets Library
Not an asynchronous model – if you do not regularly call functions you may lose data and/or lose
the TLS connection
Consider whether/where TLS is important
• Is your network secure?
• Are you running data comms and a local web server?
• Who may see the device?
• Where are transmissions reaching?
Week 6
Lab – Securing a Web Server