Skip to content

Commit

Permalink
Merge pull request #88 from omjadas/dependabot/cargo/rustls-pemfile-2…
Browse files Browse the repository at this point in the history
….0.0

chore(deps): update rustls-pemfile requirement from 1.0.0 to 2.0.0
  • Loading branch information
omjadas authored Dec 1, 2023
2 parents fa23e80 + dcff4dc commit 9c9f313
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 24 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

name: Build

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ tokio = { version = "1.24.2", features = ["rt"] }
tokio-rustls = "0.24.0"
tokio-tungstenite = "0.20.0"
tokio-util = { version = "0.7.0", features = ["io"], optional = true }
tracing = { version = "0.1.21", features = ["log"] }
tracing = { version = "0.1.23", features = ["log"] }

[dev-dependencies]
async-http-proxy = { version = "1.2.5", features = ["runtime-tokio"] }
criterion = { version = "0.5.0", features = ["async_tokio"] }
reqwest = "0.11.10"
rustls-native-certs = "0.6.2"
rustls-pemfile = "1.0.0"
rustls-pemfile = "2.0.0"
tls-listener = { version = "0.8.0", features = ["rustls", "hyper-h1", "hyper-h2"] }
tokio = { version = "1.24.2", features = ["full"] }
tokio-native-tls = "0.3.1"
Expand Down
9 changes: 7 additions & 2 deletions benches/certificate_authorities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ fn build_rcgen_ca(cache_size: u64) -> RcgenAuthority {
let mut ca_cert_bytes: &[u8] = include_bytes!("../examples/ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

RcgenAuthority::new(private_key, ca_cert, cache_size)
Expand Down
9 changes: 7 additions & 2 deletions benches/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ fn build_ca() -> RcgenAuthority {
let mut ca_cert_bytes: &[u8] = include_bytes!("../examples/ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down
9 changes: 7 additions & 2 deletions examples/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@ async fn main() {
let mut ca_cert_bytes: &[u8] = include_bytes!("ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

let ca = RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down
9 changes: 7 additions & 2 deletions examples/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ async fn main() {
let mut ca_cert_bytes: &[u8] = include_bytes!("ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

let ca = RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down
18 changes: 14 additions & 4 deletions src/certificate_authority/rcgen_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ use tracing::debug;
/// let mut ca_cert_bytes: &[u8] = include_bytes!("../../examples/ca/hudsucker.cer");
/// let private_key = rustls::PrivateKey(
/// pemfile::pkcs8_private_keys(&mut private_key_bytes)
/// .next()
/// .unwrap()
/// .remove(0),
/// .expect("Failed to parse private key")
/// .secret_pkcs8_der()
/// .to_vec(),
/// );
/// let ca_cert = rustls::Certificate(
/// pemfile::certs(&mut ca_cert_bytes)
/// .next()
/// .unwrap()
/// .remove(0),
/// .expect("Failed to parse CA certificate")
/// .to_vec(),
/// );
///
/// let ca = RcgenAuthority::new(private_key, ca_cert, 1_000).unwrap();
Expand Down Expand Up @@ -159,13 +164,18 @@ mod tests {
let mut ca_cert_bytes: &[u8] = include_bytes!("../../examples/ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

RcgenAuthority::new(private_key, ca_cert, cache_size).unwrap()
Expand Down
9 changes: 7 additions & 2 deletions src/proxy/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ use tokio_tungstenite::Connector;
/// # let mut ca_cert_bytes: &[u8] = include_bytes!("../../examples/ca/hudsucker.cer");
/// # let private_key = rustls::PrivateKey(
/// # pemfile::pkcs8_private_keys(&mut private_key_bytes)
/// # .next()
/// # .unwrap()
/// # .expect("Failed to parse private key")
/// # .remove(0),
/// # .secret_pkcs8_der()
/// # .to_vec(),
/// # );
/// # let ca_cert = rustls::Certificate(
/// # pemfile::certs(&mut ca_cert_bytes)
/// # .next()
/// # .unwrap()
/// # .expect("Failed to parse CA certificate")
/// # .remove(0),
/// # .to_vec(),
/// # );
/// #
/// # let ca = RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down
9 changes: 7 additions & 2 deletions src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ pub use builder::ProxyBuilder;
/// # let mut ca_cert_bytes: &[u8] = include_bytes!("../../examples/ca/hudsucker.cer");
/// # let private_key = rustls::PrivateKey(
/// # pemfile::pkcs8_private_keys(&mut private_key_bytes)
/// # .next()
/// # .unwrap()
/// # .expect("Failed to parse private key")
/// # .remove(0),
/// # .secret_pkcs8_der()
/// # .to_vec(),
/// # );
/// # let ca_cert = rustls::Certificate(
/// # pemfile::certs(&mut ca_cert_bytes)
/// # .next()
/// # .unwrap()
/// # .expect("Failed to parse CA certificate")
/// # .remove(0),
/// # .to_vec(),
/// # );
/// #
/// # let ca = RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down
8 changes: 7 additions & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ fn rustls_client_config() -> rustls::ClientConfig {
}

let mut ca_cert_bytes: &[u8] = include_bytes!("../../examples/ca/hudsucker.cer");
let ca_cert = rustls::Certificate(pemfile::certs(&mut ca_cert_bytes).unwrap().remove(0));
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.to_vec(),
);

roots.add(&ca_cert).unwrap();

Expand Down
9 changes: 7 additions & 2 deletions tests/rcgen_ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ fn build_ca() -> RcgenAuthority {
let mut ca_cert_bytes: &[u8] = include_bytes!("../examples/ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down
9 changes: 7 additions & 2 deletions tests/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ fn build_ca() -> RcgenAuthority {
let mut ca_cert_bytes: &[u8] = include_bytes!("../examples/ca/hudsucker.cer");
let private_key = rustls::PrivateKey(
pemfile::pkcs8_private_keys(&mut private_key_bytes)
.next()
.unwrap()
.expect("Failed to parse private key")
.remove(0),
.secret_pkcs8_der()
.to_vec(),
);
let ca_cert = rustls::Certificate(
pemfile::certs(&mut ca_cert_bytes)
.next()
.unwrap()
.expect("Failed to parse CA certificate")
.remove(0),
.to_vec(),
);

RcgenAuthority::new(private_key, ca_cert, 1_000)
Expand Down

0 comments on commit 9c9f313

Please sign in to comment.