Skip to content

Commit ad9c617

Browse files
committed
readd client credentials support
1 parent 695331b commit ad9c617

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/client.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ pub struct TlsConfig<'a, const RX_SIZE: usize = 4096, const TX_SIZE: usize = 409
4343
/// Minimum TLS version for the connection
4444
version: crate::TlsVersion,
4545

46-
/// Client certificates. See [mbedtls_rs::Certificates]
46+
/// Root certificates to trust. See [mbedtls_rs::Certificates]
4747
certificates: crate::Certificate<'a>,
4848

49+
/// Client certificate and private key for mutual TLS. See [mbedtls_rs::Certificates]
50+
client_credentials: Option<crate::Credentials<'a>>,
51+
4952
/// A reference to instance of the MbedTLS library.
5053
tls_reference: mbedtls_rs::TlsReference<'a>,
5154
}
@@ -186,7 +189,7 @@ where
186189
conn,
187190
&mbedtls_rs::SessionConfig::Client(mbedtls_rs::ClientSessionConfig {
188191
ca_chain: Some(tls.certificates.clone()),
189-
creds: None,
192+
creds: tls.client_credentials.clone(),
190193
server_name: None, // don't set it here because it would reference a local variable
191194
auth_mode: mbedtls_rs::AuthMode::Required,
192195
min_version: tls.version,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl From<embedded_tls::TlsError> for Error {
8484

8585
/// Re-export those members since they're used for [client::TlsConfig].
8686
#[cfg(feature = "mbedtls-rs")]
87-
pub use mbedtls_rs::{Certificate, TlsReference, TlsVersion, X509};
87+
pub use mbedtls_rs::{Certificate, Credentials, TlsReference, TlsVersion, X509};
8888

8989
#[cfg(feature = "mbedtls-rs")]
9090
impl From<mbedtls_rs::SessionError> for Error {

0 commit comments

Comments
 (0)