Skip to content

Commit

Permalink
Merge pull request #211 from serprex/update-rustls
Browse files Browse the repository at this point in the history
Update rustls to 0.22.1
  • Loading branch information
dermesser authored Dec 27, 2023
2 parents 34846cd + 0549b7b commit f2fcb10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ http = "0.2"
hyper = { version = "0.14", features = ["client", "server", "tcp", "http2"] }
hyper-rustls = { version = "0.24", optional = true, features = ["http2"] }
hyper-tls = { version = "0.5.0", optional = true }
itertools = "0.11"
itertools = "0.12"
log = "0.4"
percent-encoding = "2"
rustls = { version = "0.21.0", optional = true }
rustls = { version = "^0.22.1", optional = true }
rustls-pemfile = { version = "1.0.1", optional = true }
seahash = "4"
serde = {version = "1.0", features = ["derive"]}
Expand Down
10 changes: 3 additions & 7 deletions src/service_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ use base64::Engine as _;
use http::Uri;
use hyper::client::connect::Connection;
use hyper::header;
use rustls::{
self,
sign::{self, SigningKey},
PrivateKey,
};
use rustls::{self, crypto::ring::sign, pki_types::PrivateKeyDer, sign::SigningKey};
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use tokio::io::{AsyncRead, AsyncWrite};
Expand All @@ -42,13 +38,13 @@ fn append_base64<T: AsRef<[u8]> + ?Sized>(s: &T, out: &mut String) {
}

/// Decode a PKCS8 formatted RSA key.
fn decode_rsa_key(pem_pkcs8: &str) -> Result<PrivateKey, io::Error> {
fn decode_rsa_key(pem_pkcs8: &str) -> Result<PrivateKeyDer, io::Error> {
let private_keys = rustls_pemfile::pkcs8_private_keys(&mut pem_pkcs8.as_bytes());

match private_keys {
Ok(mut keys) if !keys.is_empty() => {
keys.truncate(1);
Ok(rustls::PrivateKey(keys.remove(0)))
Ok(PrivateKeyDer::Pkcs8(keys.remove(0).into()))
}
Ok(_) => Err(io::Error::new(
io::ErrorKind::InvalidInput,
Expand Down

0 comments on commit f2fcb10

Please sign in to comment.