From 1a3ef2d77ab54bfe286f7400ac0cee2e25ea14e3 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Mon, 24 Jun 2024 20:26:03 +0200 Subject: update dependencies --- p2p/src/tls_config.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'p2p/src') diff --git a/p2p/src/tls_config.rs b/p2p/src/tls_config.rs index 65d2adc..b1141a4 100644 --- a/p2p/src/tls_config.rs +++ b/p2p/src/tls_config.rs @@ -82,7 +82,7 @@ pub fn tls_server_config(key_pair: &KeyPair) -> Result { /// Generates a certificate and returns both the certificate and the private key. fn generate_cert<'a>(key_pair: &KeyPair) -> Result<(CertificateDer<'a>, PrivateKeyDer<'a>)> { - let cert_key_pair = rcgen::KeyPair::generate(&rcgen::PKCS_ED25519)?; + let cert_key_pair = rcgen::KeyPair::generate_for(&rcgen::PKCS_ED25519)?; let private_key = PrivateKeyDer::Pkcs8(cert_key_pair.serialize_der().into()); // Add a custom extension to the certificate: @@ -94,12 +94,10 @@ fn generate_cert<'a>(key_pair: &KeyPair) -> Result<(CertificateDer<'a>, PrivateK let mut ext = rcgen::CustomExtension::from_oid_content(&[0, 0, 0, 0], ext_content); ext.set_criticality(true); - let mut params = rcgen::CertificateParams::new(vec![]); - params.alg = &rcgen::PKCS_ED25519; - params.key_pair = Some(cert_key_pair); + let mut params = rcgen::CertificateParams::new(vec![])?; params.custom_extensions.push(ext); - let cert = CertificateDer::from(rcgen::Certificate::from_params(params)?.serialize_der()?); + let cert = CertificateDer::from(params.self_signed(&cert_key_pair)?); Ok((cert, private_key)) } -- cgit v1.2.3