From 3a48e91655f2b7d8e298183d9537be6c983711ed Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 13 Apr 2024 03:03:54 +0200 Subject: [PATCH] fix: force overrule signature algorithm really what????? --- src/server/fetcher.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/fetcher.rs b/src/server/fetcher.rs index e42d0be8..b1c01c73 100644 --- a/src/server/fetcher.rs +++ b/src/server/fetcher.rs @@ -6,7 +6,7 @@ use openssl::{hash::MessageDigest, pkey::{PKey, Private}, sign::Signer}; use reqwest::{header::{CONTENT_TYPE, USER_AGENT}, Method}; use sea_orm::{DatabaseConnection, EntityTrait, IntoActiveModel}; -use crate::{errors::UpubError, model, VERSION}; +use crate::{model, VERSION}; use super::Context; @@ -45,7 +45,7 @@ impl Fetcher { .header("Host", host.clone()) .header("Date", date.clone()); - let mut signature_cfg = Config::new(); + let mut signature_cfg = Config::new().mastodon_compat(); let mut to_sign_raw = format!("(request-target): post {path}\nhost: {host}\ndate: {date}"); let mut headers_to_inspect = "(request-target) host date"; @@ -61,7 +61,6 @@ impl Fetcher { } let signature_header_lib = signature_cfg - .mastodon_compat() .begin_sign("POST", &path, headers) .unwrap() .sign(format!("{from}#main-key"), |to_sign| { @@ -72,7 +71,8 @@ impl Fetcher { Ok(signature) as crate::Result<_> }) .unwrap() - .signature_header(); + .signature_header() + .replace("hs2019", "rsa-sha256"); // TODO what the fuck??? why isn't this customizable??? let signature_header = { let mut signer = Signer::new(MessageDigest::sha256(), key).unwrap();