fix: use repaired version of jsonwebkey convert lib

This commit is contained in:
Matthieu Bessat 2025-06-03 19:20:06 +02:00
parent fe5e2dcd97
commit 7a19b5a138
3 changed files with 16 additions and 15 deletions

7
Cargo.lock generated
View file

@ -972,7 +972,7 @@ dependencies = [
"chrono", "chrono",
"env_logger", "env_logger",
"fully_pub", "fully_pub",
"jsonwebkey-convert", "jsonwebkey-convert-repaired",
"jsonwebtoken", "jsonwebtoken",
"kernel", "kernel",
"log", "log",
@ -1247,8 +1247,9 @@ dependencies = [
] ]
[[package]] [[package]]
name = "jsonwebkey-convert" name = "jsonwebkey-convert-repaired"
version = "0.3.0" version = "0.3.1"
source = "git+https://forge.lefuturiste.fr/rust-libs/jsonwebkey-rs-repaired.git?branch=master#0182bf0b83ebaf0a8c64c103422363f00a4fff7f"
dependencies = [ dependencies = [
"base64 0.13.1", "base64 0.13.1",
"lazy_static", "lazy_static",

View file

@ -43,16 +43,15 @@ argh = { workspace = true }
sqlx = { workspace = true } sqlx = { workspace = true }
uuid = { workspace = true } uuid = { workspace = true }
url = { workspace = true } url = { workspace = true }
# To work with key pair
pem = "3.0.4" pem = "3.0.4"
# For now, we test if it's viable, and later we will fork it to fix the build (cf. issue [dependencies.jsonwebkey-convert-repaired]
# https://github.com/informationsea/jsonwebkey-rs#1 ) git = "https://forge.lefuturiste.fr/rust-libs/jsonwebkey-rs-repaired.git"
[dependencies.jsonwebkey-convert] branch = "master"
path = "/home/mbess/workspace/foss/rust_libs/jsonwebkey-rs/jsonwebkey-convert"
features = ["simple_asn1", "pem"] features = ["simple_asn1", "pem"]
pem = "3.0.4"
[build-dependencies] [build-dependencies]
minijinja-embed = "2.3.1" minijinja-embed = "2.3.1"

View file

@ -1,5 +1,7 @@
use jsonwebkey_convert::RSAPublicKey; use std::str::FromStr;
use jsonwebkey_convert::der::FromPem;
use jsonwebkey_convert_repaired::RSAPublicKey;
use jsonwebkey_convert_repaired::der::FromPem;
use axum::{extract::State, response::IntoResponse, Json}; use axum::{extract::State, response::IntoResponse, Json};
use fully_pub::fully_pub; use fully_pub::fully_pub;
@ -36,8 +38,7 @@ pub async fn get_signing_public_keys(
// extract modulus and exp number from ASN.1 encoded PCKS 1 package // extract modulus and exp number from ASN.1 encoded PCKS 1 package
let rsa_jwk = RSAPublicKey::from_pem(pem_data) let rsa_jwk = RSAPublicKey::from_pem(pem_data)
.expect("Expected to decode PEM public key"); .expect("Failed to extract RSA public key from PEM");
dbg!(&rsa_jwk);
Json(JWKs { Json(JWKs {
keys: vec![rsa_jwk] keys: vec![rsa_jwk]