Lecture 4-1
The Internet, Cryptography, Git
(all really fast)
CS 300 Lecture 4-1
Bart Massey
How a network works
Serial: Wire changes electrical level over time
- Wireless is the same, but without a wire
- Noise, range
- big-endian vs little-endian
Hardware on end to generate / reconstruct bytes
Usually point-to-point interfaces
One host may have many interfaces
Packets and Addressing
Useful to send sequences of bytes as a logical "packet"
- Includes error-checking
- Probably variable-length
Give each endpoint a unique identifier: "address"
- Mark packets with source and destination address
Route packets according to address
This is magic and beyond scope
Protocol Layering
Hardware network is
- Unreliable
- Out-of-order
- Limited max packet size
Add logic to retransmit packets, make larger packets, etc
- This logic is a protocol
- Typically not very dependent on underlying hardware
- In our case, TCP/IP
Addressing
- MAC-level for hardware ala ethernet 70:56:81:ba:39:1b
- IPv4 addressing: 192.168.1.1
IPv6 addressing: out of scope
TCP
Adds virtual reliable stream abstraction: packets are resent, reordered and buffered as needed
Adds concept of software endpoint "port": OS kernel can tell which software is to receive stream
Generally treated like files by programming languages: get a file descriptor, read / write it
Layering On TCP
Figure out what information you want to send/receive
Design a protocol by which that info is sent/received
The protocol needs to be serialized
Basic Cryptography
Idea: Given a public algorithm and a secret key, allow two parties with the key to communicate such that anyone without the key can't discover the communication
Very old idea
Plaintext, ciphertext
Modern cipher: takes a key, does key setup, then
- Runs transmitted bytes through an encryption algorithm first
Runs received bytes through a decryption algorithm first
Some Crypto Technicalities
Symmetric Key vs Public Key
Block cipher
- Block chaining
- IVs and setup
Feistel ciphers
RC4
Stream cipher
- Key setup initializes crypto-secure PRNG
- Xor plaintext with keystream to encrypt
- Xor ciphertext with keystream to decrypt
Tricks for setup
Some attacks
Public-key crypto
Separate encryption key and decryption key
Means everyone can publish encryption key
- Anyone can send a message readable only by recipient
SSH: RSA and DSA