K075 / Cryptographic protocols and formats
SSH
SSH is a cryptographic protocol establishing a secure channel over an insecure network.
CRYPTOGRAPHY LAB / K075
Cryptography Lab · SSH
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
SSH (RFC 4253 A–F key derivation with SHA-256; supplied exchange hash)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- SSH is a cryptographic protocol establishing a secure channel over an insecure network. Source document ↗
- Classification and reversibility
- Cryptographic transport protocol with encryption/decryption and authentication-tag verification. Source document ↗
- Key or secret requirements
- Session symmetric encryption and MAC/authentication keys; ChaCha20-Poly1305 derives two 32-byte keys per direction. Source document ↗
- Operating principle and structure
- Binary packets contain length, padding, payload and MAC, protected by negotiated cipher/MAC or AEAD. Source document ↗
- Key size, block size and parameters
- Parameters vary; chacha20-poly1305@openssh.com listed with block 8, key 64, authentication 16. Source document ↗
- Security strength and recommendation
- SSH 2.0 recommended; SSH 1.x excluded due to serious known weaknesses. Source document ↗
- Known attacks and vulnerabilities
- Implementation/configuration weaknesses, on-path server impersonation and weak algorithms are known risks. Source document ↗
- Standards and certification
- IETF core RFC 4250–4254, RFC 4344 (CTR), RFC 6239 (GCM), RFC 9142 (KEX update). Source document ↗
- Typical uses
- Remote login, command execution and remote application execution. Source document ↗
- Implementations, libraries and tools
- OpenSSH, ts-ssh, russh and ssh-key implementations/tools. Source document ↗
- Decryption or decoding
- Receiver opens/decrypts packets using session key and sequence number and verifies authentication tag. Source document ↗
- Advantages
- CTR supports parallel encryption/decryption; AEAD combines confidentiality and integrity. Source document ↗
- Limitations and cautions
- Weak algorithms, misconfiguration, implementation flaws and failed key management require care. Source document ↗
- Distinguishing encryption, encoding and hashing
- SSH transport is encryption, not encoding; distinguish tag verification and key-file formatting. Source document ↗
Practical examples
Example
After key exchange agrees session keys, client/server send packets protected by negotiated cipher/MAC or AEAD. Receiver decrypts and verifies tag to extract payload.
Procedure
Negotiate algorithms, derive session keys, assemble packet and encrypt with MAC/AEAD tag. Receive and decrypt, verify MAC/tag, remove padding/process payload. Encoding is keyless, hashing one-way, encryption keyed reversible.
Scenario
Admin remote login/commands through OpenSSH, CI/CD deployment channel. Prefer AEAD and strong KEX; disable weak algorithms.
Pitfalls and alternatives
Avoid SSH1, RC4, SHA-1 and 3DES-CBC; use current implementations/config. Validate host keys, manage key permissions/rotation, distinguish Base64/key files from encryption.
References
- Technical Guideline TR-02102-4: Use of Secure Shell (SSH) ↗
- cipher.c ↗
- The SSH Protocol: Interactive Visualizer ↗
- RFC 4253: The Secure Shell (SSH) Transport Layer Protocol | RFC Editor ↗
- Cryptographic Primitives | openssh/openssh-portable | DeepWiki ↗
- Security of Interactive and Automated Access Management Using Secure Shell (SSH) ↗
- OpenSSH: Security ↗
- OpenSSH: Specifications ↗
- README.md ↗
- [Crypto] SSH protocol dissected, part I: toy SSH client in ~1k SLOC ↗