# Utilities

Internal class delegating to a module, and displaying warnings when attributes related to the deprecated “abstractclassmethod” attributes in the josepy.util module.

class josepy.util.ComparableX509(wrapped: Union[OpenSSL.crypto.X509, OpenSSL.crypto.X509Req])

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

  Variables

    wrapped – Wrapped certificate or certificate request.

class josepy.util.ComparableKey(wrapped: Union[cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithSerialization, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey])

  Comparable wrapper for `cryptography` keys.

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

  public_key() → josepy.util.ComparableKey

    Get wrapped public key.

class josepy.util.ComparableRSAKey(wrapped: Union[cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithSerialization, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey])

  Wrapper for `cryptography` RSA keys.

  Wraps around:

  - `RSAPrivateKey`

  - `RSAPublicKey`

class josepy.util.ComparableECKey(wrapped: Union[cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKeyWithSerialization, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey])

  Wrapper for `cryptography` RSA keys. Wraps around: - `EllipticCurvePrivateKey` - `EllipticCurvePublicKey`

class josepy.util.ImmutableMap(**kwargs: Any)

  Immutable key to value mapping with attribute access.

  update(**kwargs: Any) → josepy.util.ImmutableMap

    Return updated map.

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

  Frozen dictionary.