You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Parse a key from an x509 chain. This function currently
support only the parsing of public RSA key from such a chain.
The first element of the chain will contain the verifying key.
See RFC7517 https://datatracker.ietf.org/doc/html/rfc7517#section-4.7
"""
public_key=import_rsa_key(x5c[0])
key_dict=RSAKey(pub_key=public_key).to_dict()
returnJWK(key_dict)
This would be the fixing code (that should be tested)
def parse_key_from_x5c(x5c: list[str]) -> JWK:
"""Parse a key from an x509 chain. This function currently
support only the parsing of public RSA and EC key from such a chain.
The first element of the chain will contain the verifying key.
See RFC7517 https://datatracker.ietf.org/doc/html/rfc7517#section-4.7
"""
try:
# maybe RSA?
public_key = import_rsa_key(x5c[0])
key_dict = RSAKey(pub_key=public_key).to_dict()
return JWK(key_dict)
except Exception:
# maybe EC?
public_key = import_ec_key(x5c[0])
key_dict = ECKey(pub_key=public_key).to_dict()
return JWK(key_dict)
except Exception:
# neither RSA nor EC
raise InvalidJwk(f"unable to parse key from x5c: {x5c}")
The text was updated successfully, but these errors were encountered:
Current strategy for "self contained" key extraction from jwt header does not support x5c chain that represent an EC key. Only RSA is supproted.
eudi-wallet-it-python/pyeudiw/jwk/parse.py
Lines 21 to 29 in 486aa59
This would be the fixing code (that should be tested)
The text was updated successfully, but these errors were encountered: