JSON Web Algorithms

JSON Web Algorithms.

https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40

class josepy.jwa.JWA

Bases: josepy.interfaces.JSONDeSerializable

JSON Web Algorithm.

class josepy.jwa.JWASignature(name)

Bases: josepy.jwa.JWA, _abcoll.Hashable

Base class for JSON Web Signature Algorithms.

classmethod from_json(jobj)

Deserialize a decoded JSON document.

Parameters:jobj – Python object, composed of only other basic data types, as decoded from JSON document. Not necessarily dict (as decoded from “JSON object” document).
Raises:josepy.errors.DeserializationError – if decoding was unsuccessful, e.g. in case of unparseable X509 certificate, or wrong padding in JOSE base64 encoded string, etc.
classmethod register(signature_cls)

Register class for JSON deserialization.

sign(key, msg)

Sign the msg using key.

to_partial_json()

Partially serialize.

Following the example, partial serialization means the following:

assert isinstance(Bar().to_partial_json()[0], Foo)
assert isinstance(Bar().to_partial_json()[1], Foo)

# in particular...
assert Bar().to_partial_json() != ['foo', 'foo']
Raises:josepy.errors.SerializationError – in case of any serialization error.
Returns:Partially serializable object.
verify(key, msg, sig)

Verify the msg and sig using key.

class josepy.jwa._JWAES(name)

Bases: josepy.jwa.JWASignature

sign(key, msg)

Sign the msg using key.

verify(key, msg, sig)

Verify the msg and sig using key.

class josepy.jwa._JWAHS(name, hash_)

Bases: josepy.jwa.JWASignature

kty

alias of josepy.jwk.JWKOct

sign(key, msg)

Sign the msg using key.

verify(key, msg, sig)

Verify the msg and sig using key.

class josepy.jwa._JWAPS(name, hash_)

Bases: josepy.jwa._JWARSA, josepy.jwa.JWASignature

class josepy.jwa._JWARS(name, hash_)

Bases: josepy.jwa._JWARSA, josepy.jwa.JWASignature