Signature

This module allows to sign messages, and then to verify the signature.

wacryptolib.signature.SUPPORTED_SIGNATURE_ALGOS = ['DSA_DSS', 'ECC_DSS', 'RSA_PSS']

These values can be used as 'payload_signature_algo' parameters.

wacryptolib.signature.sign_message(message, *, signature_algo, private_key)

Return a timestamped signature of the chosen type for the given payload, with the provided key (which must be of a compatible type).

Signature is actually performed on a SHA512 DIGEST of the message.

Parameters:
  • message (bytes) -- the bytestring to sign

  • signature_algo (str) -- the name of the signing algorithm

  • private_key (object) -- the cryptographic key used to create the signature

Return type:

dict

Returns:

dictionary with signature data

wacryptolib.signature.verify_message_signature(*, message, signature_algo, signature, public_key)

Verify the authenticity of a signature.

Raises if signature is invalid.

Parameters:
  • message (bytes) -- the bytestring which was signed

  • signature_algo (str) -- the name of the signing algorithm

  • signature (dict) -- structure describing the signature

  • public_key (object) -- the cryptographic key used to verify the signature