use webpki-roots-certs for rustls

This commit is contained in:
Alwin Berger 2024-09-05 17:21:25 +02:00
parent bbe8991fbf
commit 43ab9df2e5
3 changed files with 3 additions and 65 deletions

64
Cargo.lock generated
View file

@ -323,16 +323,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]] [[package]]
name = "core-foundation-sys" name = "core-foundation-sys"
version = "0.8.7" version = "0.8.7"
@ -1029,12 +1019,6 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.3" version = "0.12.3"
@ -1286,24 +1270,10 @@ version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc9c089855dc1b0f982d0d56ec62e19cf935fe6720aa6705dc61190e99b36f32" checksum = "fc9c089855dc1b0f982d0d56ec62e19cf935fe6720aa6705dc61190e99b36f32"
dependencies = [ dependencies = [
"log",
"rustls 0.23.12", "rustls 0.23.12",
"rustls-native-certs",
"rustls-pki-types", "rustls-pki-types",
"rustls-webpki 0.102.7", "rustls-webpki 0.102.7",
] "webpki-roots",
[[package]]
name = "rustls-native-certs"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a"
dependencies = [
"openssl-probe",
"rustls-pemfile 2.1.3",
"rustls-pki-types",
"schannel",
"security-framework",
] ]
[[package]] [[package]]
@ -1358,15 +1328,6 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "schannel"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
dependencies = [
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@ -1383,29 +1344,6 @@ dependencies = [
"untrusted 0.9.0", "untrusted 0.9.0",
] ]
[[package]]
name = "security-framework"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
"bitflags 2.6.0",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.209" version = "1.0.209"

View file

@ -18,7 +18,7 @@ rustls = { version = "0.23", default-features = false, features = [
"ring", "ring",
] } ] }
rustls-connector = { version = "0.21.4", default-features = false, features = [ rustls-connector = { version = "0.21.4", default-features = false, features = [
"native-certs", "webpki-roots-certs",
"rustls--ring", "rustls--ring",
] } ] }
tokio = { version = "1.40.0", features = ["net", "io-util", "time", "macros"] } tokio = { version = "1.40.0", features = ["net", "io-util", "time", "macros"] }

View file

@ -50,7 +50,7 @@ fn open_session(
> { > {
// Setup Rustls TcpStream // Setup Rustls TcpStream
let stream = TcpStream::connect((config.imap_domain.as_ref(), 993))?; let stream = TcpStream::connect((config.imap_domain.as_ref(), 993))?;
let tls = RustlsConnector::default(); let tls = RustlsConnector::new_with_webpki_roots_certs();
let tlsstream = tls.connect(&config.imap_domain, stream)?; let tlsstream = tls.connect(&config.imap_domain, stream)?;
// we pass in the domain twice to check that the server's TLS // we pass in the domain twice to check that the server's TLS