# kamvamacanda/encryption_library architecture

> Architecture diagram of the GitHub repository kamvamacanda/encryption_library, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kamvamacanda/encryption_library
- Repository: https://github.com/kamvamacanda/encryption_library

## Overview

This repository combines a small encryption library with a WebSocket chat server. The server accepts connections, reads JSON chat messages, registers logged-in users, and forwards chat messages to online recipients. The library also provides DES encryption/decryption and key generation, RSA key wrapping, and HMAC creation/verification, but the sampled code does not wire these primitives into chat processing. SenderApp is empty and Receiver only prints a greeting, so neither establishes a messaging workflow.

Main entry points: [`WebSockets.cs`](https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs) (Message dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_messaging["WebSocket messaging"]
  node_server["Chat server<br/>[WebSockets.cs]"]
  node_connection["Connection handler<br/>[WebSockets.cs]"]
  node_dispatch["Message dispatch<br/>[WebSockets.cs]"]
  node_users[("Online users<br/>[WebSockets.cs]")]
end

subgraph group_crypto["Cryptography library"]
  node_des["DES encryption<br/>[Cryptography.cs]"]
  node_rsa["RSA key wrapping<br/>[RSA Encryption.cs]"]
  node_hmac["HMAC integrity<br/>[Hashing.cs]"]
end

node_client(("WebSocket client"))
node_recipient(("Recipient client"))

node_client -->|"connects and sends"| node_server
node_server -->|"accepts connection"| node_connection
node_connection -->|"passes received JSON"| node_dispatch
node_dispatch -->|"registers or looks up"| node_users
node_dispatch -->|"forwards chat JSON"| node_recipient

click node_server "https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs"
click node_connection "https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs"
click node_dispatch "https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs"
click node_users "https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs"
click node_des "https://github.com/kamvamacanda/encryption_library/blob/master/Cryptography.cs"
click node_rsa "https://github.com/kamvamacanda/encryption_library/blob/master/RSA%20Encryption.cs"
click node_hmac "https://github.com/kamvamacanda/encryption_library/blob/master/Hashing.cs"

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_server,node_connection,node_dispatch,node_users,node_client,node_recipient toneBlue
class node_des,node_rsa,node_hmac toneAmber
```

## Components

### WebSocket messaging

- [Chat server](https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs): `WebSockets.cs`
- [Connection handler](https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs): `WebSockets.cs`
- [Message dispatch](https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs): `WebSockets.cs`
- [Online users](https://github.com/kamvamacanda/encryption_library/blob/master/WebSockets.cs): `WebSockets.cs`

### Cryptography library

- [DES encryption](https://github.com/kamvamacanda/encryption_library/blob/master/Cryptography.cs): `Cryptography.cs`
- [RSA key wrapping](https://github.com/kamvamacanda/encryption_library/blob/master/RSA%20Encryption.cs): `RSA Encryption.cs`
- [HMAC integrity](https://github.com/kamvamacanda/encryption_library/blob/master/Hashing.cs): `Hashing.cs`

### Other components

- **WebSocket client**
- **Recipient client**

## Connections

- WebSocket client → Chat server: connects and sends
- Chat server → Connection handler: accepts connection
- Connection handler → Message dispatch: passes received JSON
- Message dispatch → Online users: registers or looks up
- Message dispatch → Recipient client: forwards chat JSON
