JOSE utilities.

class josepy.util.ComparableKey(wrapped)

Bases: object

Comparable wrapper for cryptography keys.

See https://github.com/pyca/cryptography/issues/2122.


Get wrapped public key.

class josepy.util.ComparableRSAKey(wrapped)

Bases: josepy.util.ComparableKey

Wrapper for cryptography RSA keys.

Wraps around:

class josepy.util.ComparableX509(wrapped)

Bases: object

Wrapper for OpenSSL.crypto.X509** objects that supports __eq__.

Variables:wrapped – Wrapped certificate or certificate request.

Dumps the object into a buffer with the specified encoding.

Parameters:filetype (int) – The desired encoding. Should be one of OpenSSL.crypto.FILETYPE_ASN1, OpenSSL.crypto.FILETYPE_PEM, or OpenSSL.crypto.FILETYPE_TEXT.
Returns:Encoded X509 object.
Return type:str
class josepy.util.ImmutableMap(**kwargs)

Bases: _abcoll.Mapping, _abcoll.Hashable

Immutable key to value mapping with attribute access.


Return updated map.

class josepy.util.abstractclassmethod(target)

Bases: classmethod

Descriptor for an abstract classmethod.

It augments the abc framework with an abstract classmethod. This is implemented as abc.abstractclassmethod in the standard Python library starting with version 3.2.

This implementation is from a StackOverflow answer that was derived from the implementation in the Python 3.3 abc library. http://stackoverflow.com/questions/11217878/python-2-7-combine-abc-abstractmethod-and-classmethod.

class josepy.util.frozendict(*args, **kwargs)

Bases: _abcoll.Mapping, _abcoll.Hashable

Frozen dictionary.