From 01dc39cdaa378dd83bdcc4b73c0a34d870c3bc9e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 22 Nov 2023 17:38:13 +0100 Subject: [PATCH] Update to rustls-pemfile alpha --- Cargo.toml | 2 +- tests/codegen.rs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e90ba31..300b064 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ percent-encoding = "2.3" rcgen = "0.11.1" reqwest = { version = "0.11", features = ["rustls-tls-manual-roots"] } ring = "0.17.0" -rustls-pemfile = "1" +rustls-pemfile = "2.0.0-alpha.1" serde = { version = "1.0.183", features = ["derive"] } tokio = { version = "1", features = ["macros", "rt-multi-thread"] } webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.6" } diff --git a/tests/codegen.rs b/tests/codegen.rs index a15488d..704e8ef 100644 --- a/tests/codegen.rs +++ b/tests/codegen.rs @@ -308,15 +308,11 @@ impl CertificateMetadata { /// Returns the DER encoding of the certificate contained in the metadata PEM. Panics if /// there is an error, or no certificate in the PEM content. - fn der(&self) -> Vec { - let certs = rustls_pemfile::certs(&mut self.pem().as_bytes()).expect("invalid PEM"); - if certs.len() > 1 { - panic!("more than one certificate in metadata PEM"); - } - certs - .first() - .expect("missing certificate in metadata PEM") - .clone() + fn der(&self) -> CertificateDer<'static> { + rustls_pemfile::certs(&mut self.pem().as_bytes()) + .next() + .unwrap() + .expect("invalid PEM") } /// Returns the serial number for the certificate. Panics if the certificate serial number