Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Goで分解するHTTPS通信
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
yingtian
July 11, 2026
Programming
44
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Goで分解するHTTPS通信
yingtian
July 11, 2026
Other Decks in Programming
See All in Programming
Railsバージョンを4倍にした話
optim
0
360
Domain-Driven Transformation
hschwentner
2
2.3k
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
Event is what happens
moro
2
780
AmebaブログはKMPから卒業します
kmars0605
0
190
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
JIS keyboard support in Omarchy
lef237
0
110
すこし踏み込む CancellationToken
htkym
2
1.7k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
4k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.4k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
Are puppies a ranking factor?
jonoalderson
2
4.1k
WENDY [Excerpt]
tessaabrams
14
40k
The SEO Collaboration Effect
kristinabergwall1
1
590
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
For a Future-Friendly Web
brad_frost
184
10k
The Curse of the Amulet
leimatthew05
3
16k
Thoughts on Productivity
jonyablonski
76
5.4k
Transcript
Sakurada Kaito Goで分解するHTTPS通信 TLS終端プロキシを標準ライブラリだけで作る
今日のゴール HTTPSを「なんとなく安全なHTTP」から一段分解する CONNECT、TCP、TLS、証明書検証の役割をつなげて見る Goの標準ライブラリで、最小のTLS終端プロキシを追う
普段は隠れているもの Web APIを書くとき、多くはこの下を意識しない net/http リバースプロキシ OSやブラウザの証明書ストア TLSハンドシェイク TCPストリーム
使用リポジトリ https://github.com/yingtian0/TLSTerminationProxy
HTTPS 通信フロー: CONNECT からTLS 終端まで Client Proxy Origin Server 1.
CONNECT example.com:443 2. Proxy -> Client: HTTP/1.1 200 Connection Established 3. TLS Handshake (Client ↔ Proxy) 4. 動的証明書を生成 example.com 用証明書 ローカルCA で署名 CA TLS 終端 5. TLS Handshake (Proxy ↔ Origin) 6. HTTP Request / Response Client はローカルCA を信頼する必要がある Proxy 内部ではTLS 接続が2 本ある
HTTPSプロキシの入口 01 ここから先はHTTPメッセージではなく、同じTCP接続上を TLSのバイト列が流れる。 Client -> Proxy: CONNECTexample.com:443 HTTP/1.1 Proxy
-> Client: HTTP/1.1 200 Connection Established Text
02 http.Hijacker net/http の管理からTCP接続を取り出す。
TLSを2本張る 03 Client -- TLS --> Proxy -- TLS -->
Origin Text クライアント側: tls.Server(clientConn, ...) 上流サーバー側: tls.Client(serverConn, ...) 中身のバイト列: io.Copy で双方向に転送
05 プロキシはアクセス先ホスト名の証明書をその場で作る。 crypto/x509 で証明書テンプレートを作る ローカルCAで署名する クライアントはそのCAを信頼している必要がある 動的証明書
05 動的証明書 今回はOpensslでCA証明書を作成 ※curlで --cacertに作成した証明書を指定すると クライアントに信用させることができる
まとめ CONNECT はTCP トンネル開始の合図 Hijack するとHTTP 抽象から TCP ストリームへ降りられる TLS
終端プロキシは、TLS 接続を左右に 2 本持つ 証明書検証は「誰が署名したか」と 「ホスト名が合うか」を見ている