Skip to content

Commit 57340cc

Browse files
authored
chore: Update rcgen to 0.13 (#35)
* Update rcgen to 0.13 this only affects the examples, but still... * clippyall
1 parent ae91f16 commit 57340cc

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

Cargo.lock

Lines changed: 4 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ serde_test = "1.0.176"
8686
testresult = "0.4.0"
8787
tokio = { version = "1", features = ["macros", "test-util"] }
8888
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
89-
rcgen = "0.12"
89+
rcgen = "0.13"
9090
rustls = { version = "0.23", default-features = false, features = ["ring"] }
9191
tempfile = "3.10.0"
9292
futures-util = "0.3.30"

examples/connect/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{path::PathBuf, sync::Arc};
33

44
use anyhow::{bail, Context, Result};
55
use quinn::crypto::rustls::{QuicClientConfig, QuicServerConfig};
6+
use rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer};
67
use tokio::fs;
78

89
pub const EXAMPLE_ALPN: &[u8] = b"n0/iroh/examples/bytes/0";
@@ -40,22 +41,19 @@ pub async fn make_and_write_certs() -> Result<(
4041
let key_path = path.join("key.der");
4142
let cert_path = path.join("cert.der");
4243

43-
let key = cert.serialize_private_key_der();
44-
let cert = cert.serialize_der().unwrap();
44+
let key = PrivatePkcs8KeyDer::from(cert.key_pair.serialize_der());
45+
let cert: CertificateDer = cert.cert.into();
4546
tokio::fs::create_dir_all(path)
4647
.await
4748
.context("failed to create certificate directory")?;
4849
tokio::fs::write(cert_path, &cert)
4950
.await
5051
.context("failed to write certificate")?;
51-
tokio::fs::write(key_path, &key)
52+
tokio::fs::write(key_path, key.secret_pkcs8_der())
5253
.await
5354
.context("failed to write private key")?;
5455

55-
Ok((
56-
rustls::pki_types::PrivateKeyDer::try_from(key).unwrap(),
57-
rustls::pki_types::CertificateDer::from(cert),
58-
))
56+
Ok((rustls::pki_types::PrivateKeyDer::from(key), cert))
5957
}
6058

6159
// derived from `quinn/examples/client.rs`

0 commit comments

Comments
 (0)