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
Hi. If I use this library for writing a client. Can I set client certificate in the API for third party servers to do client authentication ?
To be more specific, I'm trying to write client code using your library (Thanks π ) . I'm able to authenticate server by providing the CA (root_store .add_pem_file(ca.crt)). Can I also simultaneously add client certificate for 3rd party servers to authenticate this client?
(Didn't use tls much before. Plz let me know if my question itself doesn't make sense)
(copying and pasting my explanation from elsewhere)
Why is client authentication found in the list of (..) things (in the docs?)
There's a few problems with it.
client auth in TLS1.2 and earlier is done at the wrong time in the handshake. As a result the client's identity (which unlike the server identity usually identifies a user so is PII) is sent in the clear. That's a big privacy failure.
to work around (1), some implementations do an initial server-auth handshake, then immediately renegotiate up to mutual-auth (renegotiations are encrypted). Renegotiation has quite a dismal history, and I definitely want to avoid it.
@ctz I've started taking a look at how you would implement TLS 1.2 client authentication. You can see the initial changes are here. The main issue I've run into now is that the CertificateVerify message requires computing a signature of all previous handshake messages - however, ring's API doesn't support passing a pre-computed digest. That means that computing a signature from a running digest as messages are exchanged won't work without some changes to ring.
I've also been working on-and-off on client auth. I ought to push my in-progress branch. But I could use a lot of your progress so far, so thanks!
Any thoughts on how you would approach that?
At the minute I've made HandshakeHash keep the input when compiled with the clientauth feature.
The ideal solution is to have HandshakeHash compute all supported hashes in parallel, which would also obviate the need to buffer the whole ClientHello at the layer above as we do currently. As noted, that needs ring support for client auth.
@ctz got client auth working from your branch! Thanks for the work in implementing this. Are you also planning on adding client auth support from the server end?
There's also a small issue where the signature/hash algorithm for the CertificateVerify message is calculated based on the selected ciphersuite, and not based on the capabilities of the selected certificate.
Are you also planning on adding client auth support from the server end?
Yes that should be easier.
There's also a small issue where the signature/hash algorithm for the CertificateVerify message is calculated based on the selected ciphersuite, and not based on the capabilities of the selected certificate.
Yes, that issue is also present in the normal server authentication. There and here rustls treats certificates as opaque, so will happily use a key with a cert not containing appropriate key usages, expired certs, etc. That kind of misconfiguration is hopefully rare, but I agree it's not ideal for rustls to plough on regardless. In any case, that information is mostly for the relyer.
Since supporting EdDSA signatures would require maintaining the full message transcript anyway, is the idea that certain configs could disable EdDSA and hence only need to store one (or several) rolling hashes?
It's close to done for client auth by clients, but not for servers yet. It's still in progress, but it'll be a week or so before there's more progress due to travel and stuff :)
@salmankhalid-plt what do you mean? As I understand it, only servers can authenticate clients, so that's naturally what we already support. What use case do you have in mind that you think rustls doesn't yet support?
As I understand it, only servers can authenticate clients
This does not come even close to the specification of TLS. Of course, both ends can authenticate each other - search for "mutual TLS" (which will also explain why there is no separate spec for mTLS).
Activity
ctz commentedon Jul 4, 2016
At the minute client auth isn't supported. Can I ask what API you're using that requires it?
tekjar commentedon Jul 4, 2016
I'm writing a mqtt client library where client authentication is pretty common
ctz commentedon Jul 10, 2016
(copying and pasting my explanation from elsewhere)
There's a few problems with it.
All of these are fixed in TLS1.3: client identities are encrypted and renegotiation is dropped.
Actually implementing client auth is quite a minor amount of work. It's probably best to do as a opt-in feature.
tekjar commentedon Jul 10, 2016
Even as an opt in is awesome. Will wait for this feature :)
sciyoshi commentedon Jul 18, 2016
@ctz I've started taking a look at how you would implement TLS 1.2 client authentication. You can see the initial changes are here. The main issue I've run into now is that the
CertificateVerifymessage requires computing a signature of all previous handshake messages - however,ring's API doesn't support passing a pre-computed digest. That means that computing a signature from a running digest as messages are exchanged won't work without some changes toring.Any thoughts on how you would approach that?
briansmith commentedon Jul 18, 2016
I would be happy for somebody to add this functionality to ring. It is needed for many reasons and it would be easy to do.
ctz commentedon Jul 18, 2016
I've also been working on-and-off on client auth. I ought to push my in-progress branch. But I could use a lot of your progress so far, so thanks!
At the minute I've made
HandshakeHashkeep the input when compiled with theclientauthfeature.The ideal solution is to have
HandshakeHashcompute all supported hashes in parallel, which would also obviate the need to buffer the whole ClientHello at the layer above as we do currently. As noted, that needs ring support for client auth.sciyoshi commentedon Jul 18, 2016
@ctz if you push up your branch I can compare our approaches and see what still needs work. I've opened an issue in ring here: briansmith/ring#253.
sciyoshi commentedon Jul 18, 2016
@ctz got client auth working from your branch! Thanks for the work in implementing this. Are you also planning on adding client auth support from the server end?
There's also a small issue where the signature/hash algorithm for the CertificateVerify message is calculated based on the selected ciphersuite, and not based on the capabilities of the selected certificate.
ctz commentedon Jul 19, 2016
Yes that should be easier.
Yes, that issue is also present in the normal server authentication. There and here rustls treats certificates as opaque, so will happily use a key with a cert not containing appropriate key usages, expired certs, etc. That kind of misconfiguration is hopefully rare, but I agree it's not ideal for rustls to plough on regardless. In any case, that information is mostly for the relyer.
samscott89 commentedon Jul 26, 2016
Since supporting EdDSA signatures would require maintaining the full message transcript anyway, is the idea that certain configs could disable EdDSA and hence only need to store one (or several) rolling hashes?
tekjar commentedon Jul 31, 2016
Hi. I see a client auth branch π Thanks a lot. Is this ready to be merged to master? (Also any plans for adding rustls to crates.io?)
ctz commentedon Aug 4, 2016
It's close to done for client auth by clients, but not for servers yet. It's still in progress, but it'll be a week or so before there's more progress due to travel and stuff :)
ctz commentedon Aug 14, 2016
Now pushed.
tekjar commentedon Aug 29, 2016
Thanks :)
salmankhalid-plt commentedon Jul 16, 2023
I know this has been closed by any chance to having Server side client authentication as well ?
djc commentedon Jul 16, 2023
@salmankhalid-plt what do you mean? As I understand it, only servers can authenticate clients, so that's naturally what we already support. What use case do you have in mind that you think rustls doesn't yet support?
mouse07410 commentedon Jul 16, 2023
I've no idea what the OP meant. However:
This does not come even close to the specification of TLS. Of course, both ends can authenticate each other - search for "mutual TLS" (which will also explain why there is no separate spec for mTLS).
djc commentedon Jul 17, 2023
I think that matches what I said? Servers can authenticate clients, and clients authenticate servers.
ctz commentedon Jul 17, 2023
The current state is client auth is supported on both the client- and server-side.
mouse07410 commentedon Jul 17, 2023
The way I understood your reply was that only server authenticates client, while the OP asked for the client to authenticate server:
Otherwise, we seem to be on the same page.
Fix name constraints check
rustls-benchmarking commentedon Jan 20, 2026
Benchmark results
Instruction counts
Significant differences
Click to expand
Other differences
Click to expand
Wall-time
Significant differences
There are no significant wall-time differences
Other differences
Click to expand
Memory usage
Key:
Significant differences
Click to expand
π 70599B 189a
π 66815B 193a
π -3784B +4a (-2.53%)
π 70599B 189a
π 66815B 193a
π -3784B +4a (-2.38%)
π 54879B 187a
π 52319B 189a
π -2560B +2a (-2.12%)
π 72276B 194a
π 68492B 198a
π -3784B +4a (-2.11%)
π 72276B 194a
π 68492B 198a
π -3784B +4a (-2.11%)
π 54879B 187a
π 52319B 189a
π -2560B +2a (-2.11%)
π 75128B 204a
π 71344B 208a
π -3784B +4a (-2.11%)
π 72456B 194a
π 68672B 198a
π -3784B +4a (-2.09%)
π 72456B 194a
π 68672B 198a
π -3784B +4a (-2.09%)
π 75128B 204a
π 71344B 208a
π -3784B +4a (-1.91%)
π 75128B 204a
π 71344B 208a
π -3784B +4a (-1.91%)
π 56556B 192a
π 53996B 194a
π -2560B +2a (-1.90%)
π 56556B 192a
π 53996B 194a
π -2560B +2a (-1.90%)
π 63993B 209a
π 61433B 211a
π -2560B +2a (-1.90%)
π 56736B 192a
π 54176B 194a
π -2560B +2a (-1.89%)
π 56736B 192a
π 54176B 194a
π -2560B +2a (-1.89%)
π 63835B 203a
π 61275B 205a
π -2560B +2a (-1.87%)
π 59408B 202a
π 56848B 204a
π -2560B +2a (-1.72%)
π 59408B 202a
π 56848B 204a
π -2560B +2a (-1.69%)
π 59408B 202a
π 56848B 204a
π -2560B +2a (-1.69%)
π 69831B 218a
π 67270B 220a
π -2561B +2a (-1.65%)
π 69830B 218a
π 67271B 220a
π -2559B +2a (-1.65%)
π 70463B 218a
π 67903B 220a
π -2560B +2a (-1.63%)
π 70463B 218a
π 67903B 220a
π -2560B +2a (-1.63%)
π 74512B 221a
π 71952B 223a
π -2560B +2a (-1.52%)
π 75621B 228a
π 73061B 230a
π -2560B +2a (-1.48%)
π 75621B 228a
π 73061B 230a
π -2560B +2a (-1.48%)
π 208144B 221a
π 204360B 225a
π -3784B +4a (-0.91%)
π 205421B 207a
π 201637B 211a
π -3784B +4a (-0.74%)
π 205421B 207a
π 201637B 211a
π -3784B +4a (-0.74%)
π 205633B 207a
π 201849B 211a
π -3784B +4a (-0.73%)
π 205633B 207a
π 201849B 211a
π -3784B +4a (-0.73%)
π 189701B 205a
π 187141B 207a
π -2560B +2a (-0.60%)
π 189913B 205a
π 187353B 207a
π -2560B +2a (-0.60%)
π 189913B 205a
π 187353B 207a
π -2560B +2a (-0.59%)
π 189701B 205a
π 187141B 207a
π -2560B +2a (-0.58%)
π 208188B 239a
π 205629B 241a
π -2559B +2a (-0.56%)
π 207524B 239a
π 204965B 241a
π -2559B +2a (-0.55%)
π 208172B 239a
π 205611B 241a
π -2561B +2a (-0.54%)
π 207509B 239a
π 204947B 241a
π -2562B +2a (-0.53%)
Additional information
Historical results
Checkout details: