Skip to content

Commit

Permalink
chore: update rcgen (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn authored Nov 15, 2024
2 parents a17a3dc + 27287e1 commit 2e1daa9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
19 changes: 16 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async-stream = "0.3.3"
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
quinn = { package = "iroh-quinn", version = "0.12", features = ["ring"] }
rcgen = "0.12"
rcgen = "0.13"
thousands = "0.2.0"
tracing-subscriber = "0.3.16"
tempfile = "3.5.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/split/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ futures = "0.3.26"
tracing-subscriber = "0.3.16"
quic-rpc = { path = "../../..", features = ["quinn-transport", "macros"] }
quinn = { package = "iroh-quinn", version = "0.12" }
rcgen = "0.12.0"
rcgen = "0.13"
rustls = { version = "0.23", default-features = false, features = ["ring"] }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
Expand Down
9 changes: 4 additions & 5 deletions examples/split/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,14 @@ fn make_server_endpoint(bind_addr: SocketAddr) -> anyhow::Result<(Endpoint, Vec<

fn configure_server() -> anyhow::Result<(ServerConfig, Vec<u8>)> {
let cert = rcgen::generate_simple_self_signed(vec!["localhost".into()])?;
let cert_der = cert.serialize_der()?;
let priv_key = cert.serialize_private_key_der();
let priv_key = rustls::pki_types::PrivatePkcs8KeyDer::from(priv_key);
let cert_chain = vec![rustls::pki_types::CertificateDer::from(cert_der.clone())];
let cert_der = cert.cert.der();
let priv_key = rustls::pki_types::PrivatePkcs8KeyDer::from(cert.key_pair.serialize_der());
let cert_chain = vec![cert_der.clone()];

let mut server_config = ServerConfig::with_single_cert(cert_chain, priv_key.into())?;
Arc::get_mut(&mut server_config.transport)
.unwrap()
.max_concurrent_uni_streams(0_u8.into());

Ok((server_config, cert_der))
Ok((server_config, cert_der.to_vec()))
}
9 changes: 4 additions & 5 deletions tests/quinn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ fn configure_client(server_certs: &[&[u8]]) -> anyhow::Result<ClientConfig> {
#[allow(clippy::field_reassign_with_default)] // https://github.com/rust-lang/rust-clippy/issues/6527
fn configure_server() -> anyhow::Result<(ServerConfig, Vec<u8>)> {
let cert = rcgen::generate_simple_self_signed(vec!["localhost".into()])?;
let cert_der = cert.serialize_der()?;
let priv_key = cert.serialize_private_key_der();
let priv_key = rustls::pki_types::PrivatePkcs8KeyDer::from(priv_key);
let cert_chain = vec![rustls::pki_types::CertificateDer::from(cert_der.clone())];
let cert_der = cert.cert.der();
let priv_key = rustls::pki_types::PrivatePkcs8KeyDer::from(cert.key_pair.serialize_der());
let cert_chain = vec![cert_der.clone()];

let crypto_server_config = rustls::ServerConfig::builder_with_provider(Arc::new(
rustls::crypto::ring::default_provider(),
Expand All @@ -99,7 +98,7 @@ fn configure_server() -> anyhow::Result<(ServerConfig, Vec<u8>)> {
.unwrap()
.max_concurrent_uni_streams(0_u8.into());

Ok((server_config, cert_der))
Ok((server_config, cert_der.to_vec()))
}

pub struct Endpoints {
Expand Down

0 comments on commit 2e1daa9

Please sign in to comment.