Skip to content

Commit

Permalink
Bump rustls-pemfile to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Jan 24, 2024
1 parent 6b12017 commit b386954
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
22 changes: 19 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 @@ -75,7 +75,7 @@ reedline = "0.27.1"
reqwest = { version = "0.11", features = ["default", "blocking", "json", "stream"] }
ringbuffer = "0.15.0"
rusqlite = { version = "0.30" }
rustls-pemfile = { version = "1.0.4" }
rustls-pemfile = { version = "2.0.0" }
schemars = { version = "0.8", features = [ "chrono", "uuid1" ] }
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
Expand Down
6 changes: 4 additions & 2 deletions common/src/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ use tokio_rustls::rustls::{

pub fn load_certs(path: &str) -> io::Result<Vec<Certificate>> {
certs(&mut BufReader::new(File::open(path)?))
.map(|v| v.map(|c| Certificate(c.to_vec())))
.collect::<Result<Vec<Certificate>, _>>()
.map_err(|_| {
io::Error::new(io::ErrorKind::InvalidInput, "invalid cert")
})
.map(|mut certs| certs.drain(..).map(Certificate).collect())
}

pub fn load_rsa_keys(path: &str) -> io::Result<Vec<PrivateKey>> {
rsa_private_keys(&mut BufReader::new(File::open(path)?))
.map(|v| v.map(|c| PrivateKey(c.secret_pkcs1_der().to_owned())))
.collect::<Result<Vec<PrivateKey>, _>>()
.map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid key"))
.map(|mut keys| keys.drain(..).map(PrivateKey).collect())
}

#[derive(thiserror::Error, Debug)]
Expand Down

0 comments on commit b386954

Please sign in to comment.