How rcgil30/proyecto-cripto works
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)
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
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)
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