Skip to content

Commit 0d33623

Browse files
committed
fix: CVE
1 parent 95b1a54 commit 0d33623

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

pyeudiw/jwk/parse.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,10 @@ def parse_certificate(cert: str | bytes) -> JWK:
6262
try:
6363
return parse_pem(cert)
6464
except Exception:
65-
pass
66-
67-
try:
68-
return parse_pem(DER_cert_to_PEM_cert(cert))
69-
except Exception:
70-
pass
71-
72-
raise InvalidJwk(f"unable to parse key from pem: {cert}")
65+
try:
66+
return parse_pem(DER_cert_to_PEM_cert(cert))
67+
except Exception:
68+
raise InvalidJwk(f"unable to parse key from pem: {cert}")
7369

7470
def parse_b64der(b64der: str) -> JWK:
7571
"""
@@ -97,11 +93,7 @@ def parse_x5c_keys(x5c: list[str]) -> list[JWK]:
9793
try:
9894
return [parse_certificate(cert) for cert in x5c]
9995
except Exception:
100-
pass
101-
102-
try:
103-
return [parse_certificate(DER_cert_to_PEM_cert(cert)) for cert in x5c]
104-
except Exception:
105-
pass
106-
107-
raise InvalidJwk(f"unable to parse key from pem chain: {x5c}")
96+
try:
97+
return [parse_certificate(DER_cert_to_PEM_cert(cert)) for cert in x5c]
98+
except Exception:
99+
raise InvalidJwk(f"unable to parse key from pem chain: {x5c}")

0 commit comments

Comments
 (0)