RFC 2818 - 基于 TLS 的 HTTP (HTTPS) - 快速参考 (Quick Reference)
快速参考 (Quick Reference)
HTTPS vs HTTP
| 特性 | HTTP | HTTPS |
|---|---|---|
| 协议 | http:// | https:// |
| 端口 | 80 | 443 |
| 加密 | ❌ 明文 | ✅ TLS 加密 |
| 完整性 | ❌ 无保护 | ✅ MAC 保护 |
| 认证 | ❌ 无服务器认证 | ✅ 证书认证 |
| 隐私 | ❌ 可被窃听 | ✅ 加密传输 |
TLS 握手概述 (TLS Handshake Overview)
客户端 服务器
| |
|--- ClientHello --------------->|
| |
|<-- ServerHello, Certificate ---|
|<-- ServerHelloDone ------------|
| |
|--- ClientKeyExchange --------->|
|--- ChangeCipherSpec ---------->|
|--- Finished ------------------>|
| |
|<-- ChangeCipherSpec -----------|
|<-- Finished -------------------|
| |
|=== 加密通道 ===================|
| |
|--- 加密 HTTP 请求 ------------>|
|<-- 加密 HTTP 响应 -------------|
常见工具 (Common Tools)
# OpenSSL 查看证书
openssl s_client -connect www.example.com:443 -showcerts
# 测试 TLS 版本
openssl s_client -connect www.example.com:443 -tls1_2
# 查看证书详细信息
echo | openssl s_client -connect www.example.com:443 2>/dev/null | \
openssl x509 -noout -text
# cURL 使用 HTTPS
curl -v https://www.example.com