-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webtransport: deterministically generate certificates, to survive host reboots #1824
Comments
Adding a bit more context here: We already derive a key from the host key for quic-go's stateless reset key in go-libp2p/p2p/transport/quic/transport.go Lines 198 to 200 in 63b8803
We should probably use the same construction here (with a different |
https://pkg.go.dev/crypto/ecdsa
I wish I saw that sooner. We're using ECDSA secp256 for the cert key and signature since it's the interopable default.
(from https://www.w3.org/TR/webtransport/) We could consider other key algorithms, but it depends on browser support at that point. |
Good catch! That's annoying, and I wish there was a way to turn this off. Looking at the implementation, there might be a way to hack around this though. The randomization works by reading a single byte from the supplied That means for every deterministic Of course, this is hacky, and it relies on |
Another hack is to wrap it with a reader that detects if the first read is a single byte and doesn’t advance the underlying reader. |
That’s better! No need to loop and do expensive crypto. |
we can even keep two streams of seeded pseudo-randomness and then use one stream for the single byte reads and the other for the rest of the reads. Just in case the single byte read is ever important. |
Copied from marten-seemann/go-libp2p-webtransport#2. I can't move that issue since it's not in the libp2p org.
We can generate a (cryptographically secure) (pseudo-)random value from the host's private key as an input to our certificate generation mechanism.
Furthermore, we can set the validity period of the certificate such that it is independent from the boot time of the node.
This would allow us to generate certificates with deterministic (but still unpredictable) hashes, which means that our multiaddr (which includes the certificate hash) would survive reboots of the node, even if all state (except for the private key) is lost.
The text was updated successfully, but these errors were encountered: