JSON Web Key

JSON Web Key.

class josepy.jwk.JWK(**kwargs)

Bases: josepy.json_util.TypedJSONObjectWithFields

JSON Web Key.

classmethod load(data, password=None, backend=None)

Load serialized key as JWK.

Parameters:
  • data (str) – Public or private key serialized as PEM or DER.
  • password (str) – Optional password.
  • backend – A PEMSerializationBackend and DERSerializationBackend provider.
Raises:

errors.Error – if unable to deserialize, or unsupported JWK algorithm

Returns:

JWK of an appropriate type.

Return type:

JWK

public_key()

Generate JWK with public key.

For symmetric cryptosystems, this would return self.

thumbprint(hash_function=<class 'cryptography.hazmat.primitives.hashes.SHA256'>)

Compute JWK Thumbprint.

https://tools.ietf.org/html/rfc7638

Returns:bytes
class josepy.jwk.JWKES(**kwargs)

Bases: josepy.jwk.JWK

ES JWK.

Warning

This is not yet implemented!

classmethod fields_from_json(jobj)

Deserialize fields from JSON.

fields_to_partial_json()

Serialize fields to JSON.

public_key()

Generate JWK with public key.

For symmetric cryptosystems, this would return self.

class josepy.jwk.JWKOct(**kwargs)

Bases: josepy.jwk.JWK

Symmetric JWK.

classmethod fields_from_json(jobj)

Deserialize fields from JSON.

fields_to_partial_json()

Serialize fields to JSON.

public_key()

Generate JWK with public key.

For symmetric cryptosystems, this would return self.

class josepy.jwk.JWKRSA(*args, **kwargs)

Bases: josepy.jwk.JWK

RSA JWK.

Variables:keyRSAPrivateKey or RSAPublicKey wrapped in ComparableRSAKey
classmethod _decode_param(data)

Decode Base64urlUInt.

classmethod _encode_param(data)

Encode Base64urlUInt.

Return type:unicode
classmethod fields_from_json(jobj)

Deserialize fields from JSON.

fields_to_partial_json()

Serialize fields to JSON.

public_key()

Generate JWK with public key.

For symmetric cryptosystems, this would return self.