# kavalihardhik2-rgb/computer-network-course_project- architecture

> Architecture diagram of the GitHub repository kavalihardhik2-rgb/computer-network-course_project-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kavalihardhik2-rgb/computer-network-course_project-
- Repository: https://github.com/kavalihardhik2-rgb/computer-network-course_project-

## Overview

This project simulates signed client-server messaging over TCP and demonstrates authentication, integrity, replay protection, and man-in-the-middle attacks. Alice’s client signs a fresh server challenge, then signs each sequenced message; Bob verifies both signatures and acknowledges each message. The demo orchestrates five scenarios, while Mallory’s optional proxy observes, tampers with, or replays traffic. The README and excerpts document these connections; crypto_utils.py was not excerpted, so its internal implementation is represented only at the documented capability level.

Main entry points: [`client.py`](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/client.py) (Signing Client), [`server.py`](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/server.py) (Verifier Server), [`demo.py`](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/demo.py) (Scenario Runner), [`attacker.py`](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/attacker.py) (MITM Proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Simulation"]
  node_demo["Scenario Runner<br/>[demo.py]"]
end

subgraph group_messaging["Client and Protocol"]
  node_client["Signing Client<br/>[client.py]"]
  node_protocol["TCP Message Protocol<br/>[protocol.py]"]
end

subgraph group_security["Keys and Verification"]
  node_server["Verifier Server<br/>[server.py]"]
  node_crypto["RSA and SHA-256<br/>[crypto_utils.py]"]
  node_keygen["Key Generation CLI<br/>[keygen.py]"]
  node_public_keys[("Registered Public Keys<br/>[server.py]")]
end

subgraph group_attacks["Network Attacks"]
  node_attacker["MITM Proxy<br/>[attacker.py]"]
end

node_alice(("Alice"))

node_alice -->|"sends messages"| node_client
node_client -->|"frames messages"| node_protocol
node_client -->|"signs payloads"| node_crypto
node_client -->|"exchanges messages"| node_server
node_server -->|"frames messages"| node_protocol
node_server -->|"verifies signatures"| node_crypto
node_server -->|"loads keys"| node_public_keys
node_keygen -->|"generates keys"| node_crypto
node_demo -->|"generates key pairs"| node_crypto
node_demo -->|"starts server"| node_server
node_demo -->|"runs scenarios"| node_client
node_demo -->|"starts proxy"| node_attacker
node_attacker -->|"relays messages"| node_protocol
node_attacker -->|"forwards traffic"| node_server
node_client -.->|"connects through"| node_attacker

click node_demo "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/demo.py"
click node_client "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/client.py"
click node_protocol "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/protocol.py"
click node_server "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/server.py"
click node_crypto "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/crypto_utils.py"
click node_keygen "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/keygen.py"
click node_attacker "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/attacker.py"
click node_public_keys "https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_demo toneBlue
class node_client,node_protocol toneAmber
class node_server,node_crypto,node_keygen,node_public_keys toneMint
class node_attacker toneRose
class node_alice toneIndigo
```

## Components

### Simulation

- [Scenario Runner](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/demo.py): `demo.py`

### Client and Protocol

- [Signing Client](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/client.py): `client.py`
- [TCP Message Protocol](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/protocol.py): `protocol.py`

### Keys and Verification

- [Verifier Server](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/server.py): `server.py`
- [RSA and SHA-256](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/crypto_utils.py): `crypto_utils.py`
- [Key Generation CLI](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/keygen.py): `keygen.py`
- [Registered Public Keys](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/server.py): `server.py`

### Network Attacks

- [MITM Proxy](https://github.com/kavalihardhik2-rgb/computer-network-course_project-/blob/main/attacker.py): `attacker.py`

### Other components

- **Alice**

## Connections

- Alice → Signing Client: sends messages (evidence: `README.md`)
- Signing Client → TCP Message Protocol: frames messages (evidence: `client.py`)
- Signing Client → RSA and SHA-256: signs payloads (evidence: `client.py`)
- Signing Client → Verifier Server: exchanges messages (evidence: `client.py`)
- Verifier Server → TCP Message Protocol: frames messages (evidence: `server.py`)
- Verifier Server → RSA and SHA-256: verifies signatures (evidence: `server.py`)
- Verifier Server → Registered Public Keys: loads keys (evidence: `server.py`)
- Key Generation CLI → RSA and SHA-256: generates keys (evidence: `keygen.py`)
- Scenario Runner → RSA and SHA-256: generates key pairs (evidence: `demo.py`)
- Scenario Runner → Verifier Server: starts server (evidence: `demo.py`)
- Scenario Runner → Signing Client: runs scenarios (evidence: `demo.py`)
- Scenario Runner → MITM Proxy: starts proxy (evidence: `demo.py`)
- MITM Proxy → TCP Message Protocol: relays messages (evidence: `attacker.py`)
- MITM Proxy → Verifier Server: forwards traffic (evidence: `attacker.py`)
- Signing Client → MITM Proxy: connects through (evidence: `README.md`)
