build(deps): update rustls-pemfile from 1.0.4 to 2.0.0

Co-authored-by: Benoît Cortier <bcortier@proton.me>
This commit is contained in:
Marc-André Lureau 2024-01-18 18:51:32 +09:00 committed by Benoît Cortier
parent 294b1d7d6e
commit bdb421d987
3 changed files with 30 additions and 7 deletions

22
Cargo.lock generated
View file

@ -1642,7 +1642,7 @@ dependencies = [
"pico-args",
"rand",
"rustls",
"rustls-pemfile",
"rustls-pemfile 2.0.0",
"tokio",
"tokio-rustls",
"tracing",
@ -3118,7 +3118,7 @@ dependencies = [
"pin-project-lite",
"rustls",
"rustls-native-certs",
"rustls-pemfile",
"rustls-pemfile 1.0.4",
"serde",
"serde_json",
"serde_urlencoded",
@ -3292,7 +3292,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"rustls-pemfile 1.0.4",
"schannel",
"security-framework",
]
@ -3306,6 +3306,22 @@ dependencies = [
"base64",
]
[[package]]
name = "rustls-pemfile"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4"
dependencies = [
"base64",
"rustls-pki-types",
]
[[package]]
name = "rustls-pki-types"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a"
[[package]]
name = "rustls-webpki"
version = "0.101.7"

View file

@ -51,7 +51,7 @@ ironrdp-cliprdr-native.workspace = true
anyhow = "1"
async-trait = "0.1"
rustls = "0.21"
rustls-pemfile = "1.0"
rustls-pemfile = "2.0"
bmp = "0.5"
pico-args = "0.5"
x509-cert = { version = "0.2", default-features = false, features = ["std"] }

View file

@ -97,13 +97,20 @@ fn setup_logging() -> anyhow::Result<()> {
}
fn acceptor(cert_path: &str, key_path: &str) -> anyhow::Result<TlsAcceptor> {
let cert = certs(&mut BufReader::new(File::open(cert_path)?))?[0].clone();
let key = pkcs8_private_keys(&mut BufReader::new(File::open(key_path)?))?[0].clone();
let cert = certs(&mut BufReader::new(File::open(cert_path)?))
.next()
.context("no certificate")??;
let key = pkcs8_private_keys(&mut BufReader::new(File::open(key_path)?))
.next()
.context("no private key")??;
let mut server_config = ServerConfig::builder()
.with_safe_defaults()
.with_no_client_auth()
.with_single_cert(vec![rustls::Certificate(cert)], rustls::PrivateKey(key))
.with_single_cert(
vec![rustls::Certificate(cert.as_ref().to_vec())],
rustls::PrivateKey(key.secret_pkcs8_der().to_vec()),
)
.expect("bad certificate/key");
// This adds support for the SSLKEYLOGFILE env variable (https://wiki.wireshark.org/TLS#using-the-pre-master-secret)