aboutsummaryrefslogtreecommitdiff
path: root/p2p/src
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-06-24 20:26:03 +0200
committerhozan23 <hozan23@karyontech.net>2024-06-24 20:26:03 +0200
commit1a3ef2d77ab54bfe286f7400ac0cee2e25ea14e3 (patch)
tree9014082443fffbfc7951c03b33caf48b3b0d6a68 /p2p/src
parentf3bb85508335eab91fbd76d15e74dcc575195acf (diff)
update dependencies
Diffstat (limited to 'p2p/src')
-rw-r--r--p2p/src/tls_config.rs8
1 files changed, 3 insertions, 5 deletions
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<rustls::ServerConfig> {
/// 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))
}