sfackler / rust-native-tls

Apache License 2.0
478 stars 201 forks source link

Is it possible to add client certificate? #183

Closed GopherJ closed 4 years ago

GopherJ commented 4 years ago

Hi, is it possible to add ClientConfig like rustls? (cert, private key)

I just found add_root_certificate in TlsConnector https://docs.rs/native-tls/0.2.4/native_tls/struct.TlsConnectorBuilder.html#method.add_root_certificate

sfackler commented 4 years ago

https://docs.rs/native-tls/0.2.4/native_tls/struct.TlsConnectorBuilder.html#method.identity

GopherJ commented 4 years ago

@sfackler Hi, thanks for your reply, I had a look and understood better, the naming of Identity makes me confused and why it needs password?

sfackler commented 4 years ago

An Identity is a certificate and private key combined. It can currently only be constructed from a PKCS#12 archive, which requires a password to encrypt the key.

GopherJ commented 4 years ago

ok I understood, though it's pretty strange that x509 is not supported. thanks for your patience