RFC7517: JSON Web Key

This section contains the generic implementation of RFC7517. Find how to use it in JWK Guide.

API Reference

class authlib.jose.JsonWebKey(algorithms)
JWK_AVAILABLE_ALGORITHMS = {'EC': <authlib.jose.rfc7518._backends._jwk_cryptography.ECAlgorithm object>, 'RSA': <authlib.jose.rfc7518._backends._jwk_cryptography.RSAAlgorithm object>, 'oct': <authlib.jose.rfc7518.jwk_algorithms.OCTAlgorithm object>}

Defined available JWK algorithms

loads(obj, kid=None)

Loads JSON Web Key object into a public/private key.

Parameters:
  • obj – A JWK (or JWK set) format dict
  • kid – kid of a JWK set
Returns:

key

dumps(key, kty=None, **params)

Generate JWK format for the given public/private key.

Parameters:
  • key – A public/private key
  • kty – key type of the key
  • params – Other parameters
Returns:

JWK dict

class authlib.jose.JWKAlgorithm
algorithm_location = 'kty'

Interface for JWK algorithm. JWA specification (RFC7518) SHOULD implement the algorithms for JWK with this base implementation.

prepare_key(key)

Prepare key before dumping it into JWK.

loads(obj)

Load JWK dict object into a public/private key.

dumps(key)

Dump a public/private key into JWK dict object.