From 438f244d88835d5595990b1827644f8613f88788 Mon Sep 17 00:00:00 2001 From: Bat Date: Tue, 8 May 2018 20:38:37 +0100 Subject: [PATCH] Fix request signatures We don't need to sha256 actually --- src/activity_pub/request.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/activity_pub/request.rs b/src/activity_pub/request.rs index 97e2035..dc00f75 100644 --- a/src/activity_pub/request.rs +++ b/src/activity_pub/request.rs @@ -29,11 +29,14 @@ pub fn signature(signer: &S, headers: Headers, conn: &PgConnection) - let signed_string = headers.iter().map(|h| format!("{}: {}", h.name().to_lowercase(), h.value_string())).collect::>().join("\n"); let signed_headers = headers.iter().map(|h| h.name().to_string()).collect::>().join(" ").to_lowercase(); + println!("Signing {}", signed_string); + println!("signed header {}", signed_headers); let data = signer.sign(signed_string); - let sign = hex::encode(sha256(&data[..])); + let sign = base64::encode(&data[..]); + println!("sigature {}", sign); Signature(format!( - "keyId=\"{key_id}\",algorithm=\"rsa-sha256\",headers=\"#{signed_headers}\",signature=\"#{signature}\"", + "keyId=\"{key_id}\",algorithm=\"rsa-sha256\",headers=\"{signed_headers}\",signature=\"{signature}\"", key_id = signer.get_key_id(conn), signed_headers = signed_headers, signature = sign