Update metrics, rsa

This commit is contained in:
asonix 2023-04-27 19:34:23 -05:00
parent 73bf4d1597
commit ab2dbfb439
4 changed files with 385 additions and 285 deletions

648
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -42,20 +42,20 @@ dashmap = "5.1.0"
dotenv = "0.15.0"
futures-util = "0.3.17"
lru = "0.10.0"
metrics = "0.20.1"
metrics-exporter-prometheus = { version = "0.11.0", default-features = false, features = [
metrics = "0.21.0"
metrics-exporter-prometheus = { version = "0.12.0", default-features = false, features = [
"http-listener",
] }
metrics-util = "0.14.0"
metrics-util = "0.15.0"
mime = "0.3.16"
minify-html = "0.10.0"
opentelemetry = { version = "0.18", features = ["rt-tokio"] }
opentelemetry-otlp = "0.11"
pin-project-lite = "0.2.9"
quanta = "0.10.1"
quanta = "0.11.0"
rand = "0.8"
rsa = { version = "0.8", features = ["sha2"] }
rsa-magic-public-key = "0.7.0"
rsa = { version = "0.9", features = ["sha2"] }
rsa-magic-public-key = "0.8.0"
rustls = "0.20.7"
rustls-pemfile = "1.0.1"
serde = { version = "1.0", features = ["derive"] }
@ -83,7 +83,7 @@ tokio = { version = "1", features = ["macros", "sync"] }
uuid = { version = "1", features = ["v4", "serde"] }
[dependencies.background-jobs]
version = "0.14.0"
version = "0.15.0"
default-features = false
features = ["background-jobs-actix", "error-logging"]

View file

@ -129,7 +129,7 @@ async fn do_verify(
let signature =
Signature::try_from(decoded.as_slice()).map_err(ErrorKind::ReadSignature)?;
let verifying_key = VerifyingKey::<Sha256>::new_with_prefix(public_key);
let verifying_key = VerifyingKey::<Sha256>::new(public_key);
verifying_key
.verify(signing_string.as_bytes(), &signature)
.map_err(ErrorKind::VerifySignature)?;

View file

@ -12,7 +12,7 @@ use rand::thread_rng;
use rsa::{
pkcs1v15::SigningKey,
sha2::{Digest, Sha256},
signature::RandomizedSigner,
signature::{RandomizedSigner, SignatureEncoding},
RsaPrivateKey,
};
use std::{
@ -417,9 +417,9 @@ struct Signer {
impl Signer {
fn sign(&self, signing_string: &str) -> Result<String, Error> {
let signing_key = SigningKey::<Sha256>::new_with_prefix(self.private_key.clone());
let signing_key = SigningKey::<Sha256>::new(self.private_key.clone());
let signature =
signing_key.try_sign_with_rng(&mut thread_rng(), signing_string.as_bytes())?;
Ok(STANDARD.encode(signature.as_ref()))
Ok(STANDARD.encode(signature.to_bytes().as_ref()))
}
}