You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71Lines changed: 71 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -292,6 +292,77 @@ If a private key is potentially compromised, it should be replaced, regardless o
292
292
key pinning is being used.
293
293
</details>
294
294
295
+
<details>
296
+
<summary>Can I use both, CA-issued certificates and public key pinning, at the same time?</summary>
297
+
298
+
**TL;DR: Yes. For example with a separate `tls.Config` at the [client](https://pkg.go.dev/aead.dev/mtls#Client.Config) and [server](https://pkg.go.dev/aead.dev/mtls#Server.Config)**
299
+
300
+
During the TLS handshake, the TLS client can indicate to which server it's trying to connect to via
301
+
the server name indication ([SNI](https://www.rfc-editor.org/rfc/rfc3546#section-3.1)) extension.
302
+
A TLS server may be responsible for multiple domains. For example, `foo.com` as well as `bar.com`.
303
+
A client trying to connect to this server has to include the domain name in the SNI such that the
304
+
server knows whether it should present the certificate issued for `foo.com` or the one for `bar.com`.
305
+
306
+
This mechanism can also be used to distingush between handshakes expecting a certificate issued for some
307
+
domain(s) and handshakes expecting a particular public key.
308
+
309
+
```go
310
+
http.Server{
311
+
TLSConfig: &tls.Config{
312
+
GetConfigForClient: (&mtls.Server{
313
+
// The server's private key used. Clients need to know the corresponding
314
+
// public key hash.
315
+
PrivateKey: privKey,
316
+
317
+
// Alternative TLS configuration used when clients don't provide a SNI matching the
0 commit comments