SSL/TLSとは?HTTPS暗号化と証明書の仕組みを解説
SSL/TLSはHTTPSを支えるセキュリティ層です。ブラウザとWebサイト間の通信を暗号化し、サーバーの身元を確認し、password、cookie、form、payment情報などが途中で読まれたり改ざんされたりしないように守ります。
目次
SSL/TLSとは?
SSLはSecure Sockets Layer、TLSはTransport Layer Securityの略です。現在実際に使われているのはTLSですが、慣習的にSSL certificateと呼ばれることが今でも多くあります。
サイトがTLSを使っている場合、URLはhttps://で始まります。ブラウザによってはpadlockやsecurity indicatorが表示されます。
TLSが保護するのは通信経路であり、Webサイトの内容そのものを保証するわけではありません。悪意あるサイトもHTTPSを使えます。padlockは「通信が暗号化され、certificateがdomainと一致している」ことを示すだけで、事業者の信頼性を自動的に保証するものではありません。
SSL/TLS provides:
1. Encryption
Data is scrambled so eavesdroppers cannot read it.
2. Authentication
The certificate helps prove the server is the real site.
3. Integrity
The connection can detect tampering during transit.
Without HTTPS:
Browser -> "password123" -> Wi-Fi -> ISP -> Website
Anyone on the path may be able to read or alter traffic.
With HTTPS:
Browser -> encrypted TLS data -> Wi-Fi -> ISP -> Website
Interceptors see unreadable encrypted traffic.SSLとTLSの違い
SSLとTLSは同じ意味のように使われることがありますが、技術的にはSSLは古い方式で、現代のブラウザとサーバーではTLSが使われます。
| Protocol | 年 | 状態 | メモ |
|---|---|---|---|
| SSL 1.0 | 1994 | 未公開 | 重大な設計上の問題があった |
| SSL 2.0 | 1995 | 廃止 | 安全ではなく複数の攻撃に弱い |
| SSL 3.0 | 1996 | 廃止 | POODLEなどの攻撃で破られた |
| TLS 1.0 | 1999 | 廃止 | 現代のsecurity基準では使うべきではない |
| TLS 1.1 | 2006 | 廃止 | 新しいTLS versionに置き換えられた |
| TLS 1.2 | 2008 | 対応中 | 安全に設定すれば現在も広く使われる |
| TLS 1.3 | 2018 | 推奨 | handshakeが速く、安全なdefaultを持つ |
HTTPSの仕組み
HTTPSは、TLSの中で動くHTTPです。ブラウザは通常のHTTP requestを送りますが、そのrequestは端末を出る前に暗号化されます。
TLS Handshakeを解説
暗号化されたWeb通信が始まる前に、ブラウザとサーバーはhandshakeを行います。handshakeではsecurity設定を合意し、certificateを検証し、共有の暗号鍵を作成します。
Simplified TLS handshake:
1. ClientHello
Browser sends supported TLS versions, cipher suites, and random data.
2. ServerHello
Server chooses TLS settings and sends its certificate.
3. Certificate validation
Browser checks domain name, issuer, chain, signature, and expiration.
4. Key exchange
Browser and server agree on shared session keys.
5. Finished messages
Both sides confirm the handshake was not tampered with.
6. Encrypted HTTP
Normal HTTP requests and responses now travel inside TLS.SSL証明書の中身
SSL証明書は、domain nameとpublic keyを結び付け、証明書の発行者を示すdigital documentです。ブラウザはこれを使って、certificateを提示したサーバーがそのdomainを代表してよいか確認します。
A certificate usually contains:
Subject: www.example.com
Issuer: Example Certificate Authority
Valid from: 2026-01-01
Valid until: 2026-04-01
Public key: RSA or ECDSA public key
SAN entries: example.com, www.example.com
Signature: CA signature over the certificate data
Serial number: Unique identifier from the CA証明書タイプ: DV、OV、EV
証明書タイプの違いは、主にcertificate authorityが発行前にどれだけ身元確認を行うかです。
| Type | 検証内容 | 主な用途 |
|---|---|---|
| DV | Domain Validation: domainを管理できることを証明する | ブログ、アプリ、API、個人サイト、多くのWebサイト |
| OV | Organization Validation: domainと組織情報を確認する | 証明書に組織情報を載せたい企業 |
| EV | Extended Validation: より厳格な組織確認を行う | 金融、enterprise、compliance重視の一部サイト |
| Wildcard | *.example.comのように1階層のsubdomainをまとめて対象にする | 同一domain配下に多くのsubdomainがある場合 |
| SAN / Multi-domain | 1つのcertificateに複数の名前を含める | 複数domainやhostnameを同じserviceで扱う場合 |
Certificate Chain of Trust
ブラウザはすべてのWebサイト証明書を個別に信頼しているわけではありません。root certificate authorityを信頼し、正しいcertificate chainによってwebsite certificateが信頼済みrootへつながるかを確認します。
Certificate chain:
Root CA
-> Intermediate CA
-> Website certificate
Your browser already trusts many root CAs.
The website sends its certificate and usually the intermediate certificate.
The browser builds a chain back to a trusted root.SSL証明書を取得する方法
多くのサイトはhosting provider、CDN、managed platform、certificate authorityを通じてcertificateを取得します。Let’s Encryptのような自動化サービスにより、無料で取得・更新できる場合も多くあります。
- HTTPSが必要なdomain nameを決める。wwwあり/なしの両方も確認する。
- host、CDN、certificate authorityからcertificateを作成またはrequestする。
- DNS record、HTTP file、email approvalなどでdomain validationを完了する。
- serverまたはplatformへcertificateとprivate keyをinstallする。
- HTTPからHTTPSへのredirectを有効にし、期限切れ前にcertificateを更新する。
よくあるSSL/TLSエラー
SSL/TLS errorは、ブラウザがcertificateを安全に検証できない、またはsecure connectionを確立できないことを意味する場合が多いです。
| Error | よくある原因 | 修正方法 |
|---|---|---|
| Certificate expired | certificateの有効期限が切れている | 新しいcertificateへ更新してinstallする |
| Name mismatch | certificateにrequested hostnameが含まれていない | 正しいSAN nameを含むcertificateを発行する |
| Untrusted issuer | certificate chainが信頼済みrootへつながらない | intermediate certificateをinstallする、または信頼済みCAを使う |
| Mixed content | HTTPS pageがHTTP経由でimage、script、CSSを読み込んでいる | resource URLをHTTPSへ変更する |
| Old TLS version | serverが古いprotocolしか対応していない | TLS 1.2とTLS 1.3を有効にする |
| Clock wrong | client端末の日付や時刻が間違っている | system clockを修正する |
SSL/TLSのベストプラクティス
有効なcertificateはHTTPS securityの一部にすぎません。設定も同じくらい重要です。
| 実践 | 重要な理由 |
|---|---|
| TLS 1.2とTLS 1.3を使う | SSLv2、SSLv3、TLS 1.0、TLS 1.1を無効化する |
| 更新を自動化する | certificate期限切れによるoutageを防ぐ |
| HTTPをHTTPSへredirectする | ユーザーを暗号化されたページに保つ |
| HSTSを慎重に有効化する | browserへ常にHTTPSを使うよう指示する |
| Mixed contentを避ける | script、style、font、image、APIをHTTPSで読み込む |
| private keyを保護する | source controlへcommitしたり、不用意に共有したりしない |
SSL証明書を確認する方法
certificateを確認すると、有効期限、issuer、hostname coverage、chain validity、対応TLS versionを検証できます。
Check a certificate from the terminal:
openssl s_client -connect example.com:443 -servername example.com
Show certificate dates:
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -dates -issuer -subjectSSL証明書を確認
無料のSSL Checkerで、certificateの有効性、issuer、有効期限、hostname coverage、よくあるHTTPS設定問題を確認できます。
SSL Checkerを開く参考資料
- RFC 8446 - The Transport Layer Security (TLS) Protocol Version 1.3
- RFC 5246 - The Transport Layer Security (TLS) Protocol Version 1.2
- CA/Browser Forum Baseline Requirements
- Mozilla Server Side TLS recommendations
- Let’s Encrypt documentation