How rcgil30/proyecto-cripto works
<explanation>
To help you create an accurate, detailed system-design diagram for this SSH client-server project, follow these tailored steps. We’ll break the system into its core components, show how they interact, and highlight the technologies and design patterns in use.
1. Identify the Main Components
a. Client Application (src/client/ssh_client.py)
b. Server Application (src/server/ssh_server.py)
c. Cryptography Layer (src/crypto/)
- classic_crypto (ECDH-P256, RSA-SHA256, AES-192-CBC, HMAC-SHA256)
- pq_crypto (Kyber512, Dilithium2, AES-192-CBC, HMAC-SHA256)
- crypto_factory (selects between classical and PQC implementations)
d. Configuration Loader (parses .env variables: HOST, PORT, USE_PQC, MAX_CONNECTIONS)
e. Network Transport (TCP sockets over configured HOST:PORT)
2. Determine Relationships & Data Flows
- Client starts → reads config → initializes Crypto via crypto_factory → opens TCP socket → begins SSH handshake
- Handshake on both sides uses the same Crypto implementation (classical vs. PQC)
- Key exchange → session keys → secure channel established
- Application data encrypted/decrypted via AES-192-CBC + HMAC-SHA256
- Client ↔ Network Transport ↔ Server
- Server listens for one connection (MAX_CONNECTIONS=1), then repeats handshake & data flow
3. Highlight Architectural Patterns & Principles
- Factory Pattern: crypto_factory instantiates either ClassicCrypto or PQCrypto based on USE_PQC flag
- Strategy Pattern: interchangeable crypto algorithms implementing a common interface
- Layered Architecture:
• Configuration Layer
• Application Layer (client/server logic)
• Cryptography Layer (algorithm implementations)
• Transport Layer (socket I/O)
- Single-Responsibility: each module has a distinct role (e.g., SSH logic vs. crypto vs. config)
4. Map Technologies & Libraries
- Python 3.9+
- socket (built-in) for TCP transport
- python-dotenv (via requirements.txt) for .env loading
- liboqs-python for post-quantum primitives
- Standard Python crypto libraries (e.g., Cryptography.io) or OpenSSL bindings for ECDH, RSA, AES, HMAC
5. Guidelines for Drawing the Diagram
a. Use distinct shapes or colors:
- Blue rectangles for “Application Components” (Client, Server)
- Green rectangles for “Crypto Implementations” (ClassicCrypto, PQCrypto)
- Yellow rectangle for Crypto Factory
- Gray cylinder for Configuration (.env)
- Rounded rectangle for Network Transport (TCP Socket)
b. Label each component clearly. Include module path if needed (e.g., src/client/ssh_client.py).
c. Draw directional arrows to show:
- Configuration → Client & Server (configuration injection)
- Client ↔ Network Transport ↔ Server (bidirectional data flow)
- Client & Server → Crypto Factory → [ClassicCrypto or PQCrypto] (dependency flow)
d. Annotate edges with protocol steps:
- “Handshake: Key Exchange, Signature Verification (future)”
- “Encrypted Data: AES-192-CBC + HMAC-SHA256”
e. Optionally use swimlanes or layers to separate Configuration, Application, Crypto, Transport
6. Tailoring Notes for This Project
- Emphasize that both client and server share the same Cryptography Layer, selected at runtime.
- Show that signature verification is planned but currently disabled (annotate on the handshake arrow).
- Make it clear that only one connection is accepted concurrently (MAX_CONNECTIONS=1).
- If USE_PQC=false, the factory will route to ClassicCrypto—indicate this decision point.
7. Required Diagram Elements Checklist
- Component labels: Client, Server, Crypto Factory, ClassicCrypto, PQCrypto, Config Loader, TCP Socket
- Arrows showing:
• Config → Client/Server initialization
• Client ↔ Server via TCP Socket
• Client/Server → Crypto Factory → Crypto Impl.
- Color or shape legend for types: Application vs. Crypto vs. Infrastructure
- Annotations for protocols, algorithms, and future features (signature verification)
By following this outline, your system-design diagram will capture every essential architectural element: the separation of concerns, design patterns, crypto choices, and the runtime decision flow. This level of detail will give stakeholders and new team members immediate clarity on how the SSH client-server implementation is structured and operates.
</explanation>