Skip to content

Commit

Permalink
darkirc/irc: Update TLS cert handling for new rustls-pemfile API
Browse files Browse the repository at this point in the history
  • Loading branch information
parazyd committed Oct 27, 2023
1 parent a41668a commit 299e70f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/darkirc/src/irc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ impl IrcServer {
// openssl x509 -req -in example.com.csr -signkey example.com.key -out example.com.crt
let f = File::open(expand_path(tls_secret.as_ref().unwrap())?)?;
let mut reader = BufReader::new(f);
let secret = &rustls_pemfile::pkcs8_private_keys(&mut reader)?[0];
let secret = rustls::PrivateKey(secret.clone());
let secret =
&rustls_pemfile::pkcs8_private_keys(&mut reader).next().unwrap().unwrap();
let secret = rustls::PrivateKey(secret.secret_pkcs8_der().to_vec());

let f = File::open(expand_path(tls_cert.as_ref().unwrap())?)?;
let mut reader = BufReader::new(f);
let cert = &rustls_pemfile::certs(&mut reader)?[0];
let cert = rustls::Certificate(cert.clone());
let cert = &rustls_pemfile::certs(&mut reader).next().unwrap().unwrap();
let cert = rustls::Certificate(cert.to_vec());

let config = rustls::ServerConfig::builder()
.with_safe_defaults()
Expand Down

0 comments on commit 299e70f

Please sign in to comment.