SSL/TLS and SSH are both encryption protocols that use public key cryptography. But they solve different problems for different audiences. SSL/TLS secures web connections (HTTPS). SSH secures remote server access (terminal/command line).
Comparativa rápida
| SSL/TLS | SSH | |
|---|---|---|
| Full name | Secure Sockets Layer / Transport Layer Security | Secure Shell |
| Purpose | Encrypt web traffic | Remote server access |
| Used by | Browsers, web servers, APIs | System administrators, developers |
| Port | 443 (HTTPS) | 22 |
| Authentication | Certificate from a CA | Public key or password |
| Certificate Authority needed | Yes (for public trust) | No |
| Typical user | Website visitors (unknowing) | Server administrators (intentional) |
| Connection type | Client (browser) → Server | User terminal → Server |
| Encrypts | HTTP requests/responses | Shell commands, file transfers |
| Examples | HTTPS websites, APIs, email (IMAPS) | ssh user@server, scp, sftp |
SSL/TLS in one paragraph
SSL/TLS encrypts the connection between a web browser and a server. When you visit https://example.com, your browser verifies the server’s SSL certificate (issued by a Certificate Authority), negotiates encryption parameters, and all traffic flows through an encrypted channel. The user doesn’t need to do anything — HTTPS is transparent.
SSH in one paragraph
SSH encrypts the connection between a user’s terminal and a remote server. When you run ssh user@server.com, the SSH client verifies the server’s public key (you confirm on first connect), authenticates you (with a password or SSH key pair), and gives you an encrypted shell session. SSH is used by developers and admins — regular users rarely interact with it.
They use similar cryptography
Both protocols use the same underlying math:
| Concept | In SSL/TLS | In SSH |
|---|---|---|
| Asymmetric encryption | Server’s public key in certificate | Server’s host key + user’s SSH key |
| Key exchange | ECDHE Diffie-Hellman | Diffie-Hellman or ECDH |
| Symmetric encryption | AES-GCM, ChaCha20 | AES, ChaCha20 |
| Integrity | HMAC / AEAD | HMAC / AEAD |
| Forward secrecy | Via ECDHE (mandatory in TLS 1.3) | Via DH/ECDH |
The algorithms are nearly identical. The difference is the protocol layer and trust model.
The trust model difference
SSL/TLS: Certificate Authorities
SSL/TLS uses third-party trust. Your browser trusts ~100-150 Certificate Authorities. When a server presents a certificate signed by a trusted CA, the browser accepts it automatically.
You trust CAs to verify that google.com’s certificate actually belongs to Google.
SSH: Trust on First Use (TOFU)
SSH uses direct trust. The first time you connect to a server, SSH asks:
The authenticity of host 'server.com' can't be established.
ED25519 key fingerprint is SHA256:xyz...
Are you sure you want to continue connecting? (yes/no)
You verify the fingerprint once, SSH remembers it (~/.ssh/known_hosts), and future connections verify against it. No CA involved.
Can they be used together?
Yes — they’re complementary, not competing:
- SSL/TLS secures the website your visitors see (
https://example.com) - SSH secures how you manage the server that runs the website (
ssh admin@server) - You might SSH into a server to install an SSL certificate on Nginx
Most servers have both port 443 (HTTPS with SSL/TLS) and port 22 (SSH) open simultaneously.
Preguntas frecuentes
Which is more secure?
Neither — they’re equally secure when properly configured. Both use the same cryptographic algorithms. The question is like asking “which is more secure, a lock on your front door or a lock on your car?” They protect different things.
Do I need both?
For a web server: typically yes. SSL/TLS protects your visitors (HTTPS). SSH protects your access to the server (administration). They serve different purposes.
Is SFTP the same as FTPS?
No. SFTP (SSH File Transfer Protocol) runs over SSH (port 22). FTPS (FTP Secure) runs over SSL/TLS (port 990 or 21 with STARTTLS). Both encrypt file transfers, but they use different protocols. SFTP is more common and simpler to configure.
Can SSL/TLS replace SSH?
No. SSL/TLS doesn’t provide a shell or command-line interface. You can’t “SSH into a server” using TLS. Some web-based terminals (like Wetty or ttyd) provide shell access over HTTPS/WebSocket, but the underlying concept is different.