Encryption

class dane_jwe_jws.encryption.Encryption

This class wraps functions for message encryption.

classmethod decrypt(message, private_key)

Return a decrypted message.

Parameters
  • message (str) – JWE to be decrypted.

  • private_key (str) – Path to private key.

Returns

Decrypted contents of JWE.

Return type

str

classmethod encrypt(message, dane_id, header_field='x5u')

Return True if the message signature is valid, otherwise False.

The public key algorithm is RSA-OAEP-256. The encryption algorithm is A256CBC-HS512.

Parameters
  • message (str) – Message to be encrypted.

  • dane_id (str) – DANE identity for locating encryption key.

  • header_field (str) – Header field where DANE URI can be found. Defaults to x5u.

Returns

Encrypted and serialized JWE.

Return type

str