From cd2b0a752d297aa0883f5b70a343a9513bcca76e Mon Sep 17 00:00:00 2001 From: Tol Wassman <92056853+twassman@users.noreply.github.com> Date: Tue, 15 Oct 2024 19:18:05 +0000 Subject: [PATCH 1/4] provide RSA public key when making request fix "Signature type is not supported" error (char/duo-hotp-export#1) --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index d15b7ee..4c47d4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use openssl::rsa::Rsa; use reqwest::{blocking::Client, header::USER_AGENT}; use serde_json::Value; @@ -49,6 +50,10 @@ fn fetch_api_details(authority: &str, code: &str, counter: u32) -> String { ("language", "en"), ("model", "Pixel 3a"), ("security_patch_level", "2021-02-01"), + ("pkpush", "rsa-sha512"), + ("pubkey", std::str::from_utf8( + &Rsa::generate(2048).unwrap().public_key_to_pem().unwrap() + ).unwrap()), ]) .build() .unwrap(); From 6e0126097f4188eae8232d3fd96bdba7828ff88e Mon Sep 17 00:00:00 2001 From: Tol Wassman <92056853+twassman@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:34:19 +0000 Subject: [PATCH 2/4] Update Cargo.lock --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 5c4de43..1d03546 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -247,6 +247,7 @@ dependencies = [ "clap", "image 0.22.5", "qrcode", + "openssl", "reqwest", "serde", "serde_json", From 0f6eee49a98e1cca34c57f85d0fb6fb1ab3abaaf Mon Sep 17 00:00:00 2001 From: Tol Wassman <92056853+twassman@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:35:02 +0000 Subject: [PATCH 3/4] Update Cargo.toml --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 4ee1313..b3dbf46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ base32 = "0.4.0" base64 = "0.13.0" clap = "2.33.3" image = "0.22" +openssl = "0.10" qrcode = "0.12.0" reqwest = { version = "0.11.3", features = ["blocking"] } serde = "1.0.126" From 3a17f403290eeaf5fc955af2566490d86f5595c6 Mon Sep 17 00:00:00 2001 From: Tol Wassman <92056853+twassman@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:48:55 +0000 Subject: [PATCH 4/4] remove use declaration and directly reference openssl::rsa::Rsa --- src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4c47d4d..cd070cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -use openssl::rsa::Rsa; use reqwest::{blocking::Client, header::USER_AGENT}; use serde_json::Value; @@ -52,7 +51,7 @@ fn fetch_api_details(authority: &str, code: &str, counter: u32) -> String { ("security_patch_level", "2021-02-01"), ("pkpush", "rsa-sha512"), ("pubkey", std::str::from_utf8( - &Rsa::generate(2048).unwrap().public_key_to_pem().unwrap() + &openssl::rsa::Rsa::generate(2048).unwrap().public_key_to_pem().unwrap() ).unwrap()), ]) .build()