Skip to content

Commit 20b7a05

Browse files
Workaround private pem missmatch in e2e tests (#6716)
Co-authored-by: Amaury Chamayou <[email protected]>
1 parent e252947 commit 20b7a05

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/npm_tests.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,16 @@ def generate_and_verify_jwk(client):
9494

9595
r = client.post("/app/rsaJwkToPem", body={"jwk": body})
9696
body = r.body.json()
97-
assert r.status_code == http.HTTPStatus.OK
98-
assert body["pem"] == priv_pem
97+
converted_pem = body["pem"]
98+
99+
# PEMs may vary because of discrepancies of RSA key private components
100+
# computation, in particular, using Euler VS Carmichael totient
101+
# functions. For more details check the thread:
102+
# https://github.com/microsoft/CCF/issues/6588#issuecomment-2568037993.
103+
algorithm = {"name": "RSA-PSS", "hash": "SHA-256"}
104+
data = rand_bytes(random.randint(2, 50))
105+
signature = infra.crypto.sign(algorithm, converted_pem, data)
106+
infra.crypto.verify_signature(algorithm, signature, data, pub_pem)
99107

100108
# Public
101109
ref_pub_jwk = jwk.JWK.from_pem(pub_pem.encode()).export(as_dict=True)

0 commit comments

Comments
 (0)