gh pr list dozens of times a day. The answer comes back in under a second from a server I’ve never met, and
nobody in between can read it or change it. One evening I got curious about what actually happens in that second.Following one command onto the wire#
First, where does gh go? Its debug switch shows every request:
GH_DEBUG=api gh api rate_limit* Request to https://api.github.com/rate_limit
> GET /rate_limit HTTP/1.1
> Authorization: token ████████████████████
< HTTP/2.0 200 OK
* Request took 402.1103msSo it’s an ordinary HTTPS call to api.github.com, carrying my login token (the debug output masks it). The
interesting part happens before that request, when the connection is set up. OpenSSL can show that step. I ran this
on Linux with OpenSSL 3.5 and trimmed the output to the lines that matter:
echo | openssl s_client -connect api.github.com:443 -servername api.github.comCertificate chain
0 s:CN=*.github.com
i:C=GB, O=Sectigo Limited, CN=Sectigo Public Server Authentication CA DV E36
a:PKEY: EC, (prime256v1); sigalg: ecdsa-with-SHA256
1 s:C=GB, O=Sectigo Limited, CN=Sectigo Public Server Authentication CA DV E36
i:C=GB, O=Sectigo Limited, CN=Sectigo Public Server Authentication Root E46
No client certificate CA names sent
Peer signature type: ecdsa_secp256r1_sha256
Peer Temp Key: X25519, 253 bits
Verification: OK
New, TLSv1.3, Cipher is TLS_AES_128_GCM_SHA256Ten lines, and nearly every one names a different piece of cryptography. The rest of this post decodes them.
Three jobs#
Strip away the names and the connection is doing three jobs:
- Keep a secret. Only GitHub and I can read what’s sent.
- Prove who’s talking. It really is GitHub, not someone pretending.
- Prove nothing changed. Nobody altered the data on the way.
The TLS 1.3 standard says the same in one line: it is “designed to prevent eavesdropping, tampering, and message forgery”. The current text is RFC 9846 (July 2026), “a minor update to TLS 1.3” that replaced the original RFC 8446 and kept the version number.
Cipher is TLS_AES_128_GCM_SHA256: the shared key#
The simplest lock is a house key cut twice: you keep one copy, I keep the other, and either of us can lock or unlock the box. This is symmetric or shared-key encryption, and its workhorse is AES. It’s fast, so it carries the actual data. The name on that line says AES, with a 128-bit key, in GCM mode, which also checks that nothing was altered, plus SHA-256, a hash we’ll meet below.
It has one big problem. How did GitHub and my laptop get the same key, when they’ve never met and every packet between them crosses networks I don’t control?
Peer Temp Key: X25519: agreeing a key in public#
The classic picture uses paint. We both start with the same tin of yellow, in public. I secretly add my own colour and send you the mix; you add yours and send me your mix. Each of us then adds our own secret colour to the mix we received, and we end up with the same final colour. Anyone watching saw only the two mixes, which are very hard to “unmix”.
Whitfield Diffie and Martin Hellman published that idea in 1976 (“New Directions in Cryptography”). Modern versions use elliptic curves and are called ECDH. X25519 is the one on my screen: its standard says it works on “32-byte strings” and “is used when implementing Diffie-Hellman” (RFC 7748). “Temp” means a fresh key pair for this connection only. The colour we agree on becomes the AES key.
RSA, from 1977, offers another way: hand out open padlocks. Anyone can snap one shut on a box, but only you hold the key that opens it. The RSA paper promised that “couriers or other secure means are not needed to transmit keys”. TLS 1.3 uses the Diffie-Hellman style, but RSA is still everywhere in certificates and older systems.
These are public-key methods: each side has a public key it can hand to anyone, and a private key it never shares.
ecdsa-with-SHA256: proving who’s talking#
Agreeing a key with a stranger is no use if the stranger is an impostor. That’s what the certificate lines are for.
A wax seal is something only its owner can make, but anyone who knows the seal can check it. A digital signature works the same way: signed with a private key, checked with the public key. My screen shows two kinds:
- The certificate chain. GitHub’s certificate for
*.github.comis signed by Sectigo, whose certificate is signed by Sectigo’s root, which my computer already trusts. Eachsigalg: ecdsa-with-SHA256is a seal on the link below. Peer signature type: ecdsa_secp256r1_sha256. During the handshake GitHub’s server signs the conversation so far with its own private key. RFC 9846 calls this “a signature over the entire handshake”. It proves the server holds the key in the certificate, right now.
The names you’ll meet are ECDSA (signatures on elliptic curves, as here), RSA (which signs as well), and EdDSA, usually Ed25519, which offers “high performance” with “small public keys (32 or 57 bytes) and signatures (64 or 114 bytes)” (RFC 8032).
Verification: OK means my side checked every seal in the chain and they all held.
Hashes: proving nothing changed#
The last tool is a fingerprint. A hash such as SHA-256 turns any data, of any size, into a short fixed-size
fingerprint; change one letter and the fingerprint changes. Hashes sit inside almost every line above: in
ecdsa-with-SHA256 the signature is made over a hash of the certificate, and the handshake is fingerprinted as it
goes. Mix a hash with a shared secret and you get HMAC, “a mechanism for message authentication using
cryptographic hash functions” (RFC 2104).
No client certificate CA names sent: when the server checks me too#
That line is easy to skip. It says GitHub didn’t ask my side for a certificate. RFC 9846 puts it this way: “The
server side of the channel is always authenticated; the client side is optionally authenticated.” For gh, I prove
who I am later, with the token inside the encrypted connection.
Between services, the optional part is often switched on. In mutual TLS (mTLS), the client also presents a certificate and signs the handshake with its private key, so each side checks the other’s seal before a byte of data moves. It’s common between microservices and in service meshes, where there’s no human to type a password. For this series that matters for one reason: mTLS doubles the signatures, and every one of them is public-key cryptography.
A surprise: who signed GitHub’s certificate?#
The first time I ran that openssl command, on Windows, the chain didn’t end at Sectigo. The issuer was the
antivirus on my laptop. As far as I can tell, it inspects encrypted traffic by ending my connection itself, opening
its own to GitHub, and handing me a certificate it signed with a root it had installed in Windows’ list of trusted
roots. OpenSSL, which keeps its own list, noticed: “unable to verify the first certificate”. A small Go program, which
uses the Windows list, accepted the same certificate without a word.
Nothing was broken, but it taught me two things: the seal is only as good as the list of roots you trust, and when you measure a connection, make sure you’re measuring the one you think you are. (The output above is from Linux, where the real chain shows.)
The one split that matters#
| On my screen | Name | Job | Everyday picture | Family |
|---|---|---|---|---|
Peer Temp Key | X25519, ECDH, Diffie-Hellman, RSA | Agree a key | Mixing paint; open padlocks | Public-key |
sigalg, Peer signature type | ECDSA, EdDSA, RSA | Prove who’s talking | A wax seal | Public-key |
Cipher is TLS_AES_... | AES | Encrypt the data | A house key cut twice | Shared-key |
..._SHA256 | SHA-256, HMAC | Prove nothing changed | A fingerprint | Shared-key side |
Hold on to the last column. The public-key family works because it rests on maths puzzles that are easy to set and very hard to undo: RSA on “the difficulty of factoring” a huge number, and the curves and Diffie-Hellman on a cousin of that puzzle called the discrete logarithm. The next post is about why those puzzles have started to worry me.
Keywords#
| Keyword | Meaning here |
|---|---|
| TLS | The protocol behind HTTPS; it uses everything below |
| Symmetric / shared-key | Both sides hold the same key (AES) |
| Public-key / asymmetric | Each side has a public key to share and a private key to keep |
| Key exchange | Two strangers agreeing a secret over a public line (Diffie-Hellman, ECDH, X25519) |
| Digital signature | Proof made with a private key that anyone can check with the public key (ECDSA, EdDSA, RSA) |
| Certificate chain | Signatures linking a server’s key to a root your computer already trusts |
| Hash | A short fixed-size fingerprint of any data (SHA-256) |
| HMAC | A hash mixed with a shared secret, to prove who sent a message |
| mTLS | Mutual TLS: the client also presents a certificate and signs the handshake |
Takeaways#
- One
ghcommand opens a TLS connection that does three jobs: keep a secret, prove who’s talking, prove nothing changed. - AES carries the data; key exchange (X25519) is how two strangers get the shared AES key.
- Signatures (ECDSA, EdDSA, RSA) prove identity, in the certificate chain and over the handshake; mTLS adds the client’s signature too.
- Hashes (SHA-256) fingerprint everything along the way.
- Key exchange and signatures are public-key cryptography, resting on hard maths puzzles. That’s where this series begins.
References#
- RFC 9846, The Transport Layer Security (TLS) Protocol Version 1.3: IETF, July 2026; what TLS prevents, server always and client optionally authenticated, signature over the handshake; obsoletes RFC 8446
- New Directions in Cryptography: W. Diffie and M. Hellman, IEEE Transactions on Information Theory, November 1976
- A Method for Obtaining Digital Signatures and Public-Key Cryptosystems: R. Rivest, A. Shamir, L. Adleman, 1977; no couriers, security from factoring
- RFC 7748, Elliptic Curves for Security: IRTF; X25519, 32-byte strings, used for Diffie-Hellman
- RFC 8032, Edwards-Curve Digital Signature Algorithm (EdDSA): IRTF; Ed25519’s performance and key and signature sizes
- RFC 2104, HMAC: Keyed-Hashing for Message Authentication: IETF; what HMAC is



