:py:mod:`dsse` ============== .. py:module:: dsse .. autoapi-nested-parse:: DSSE (Dead Simple Signing Envelope) implementation. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dsse.DSSE .. py:exception:: DSSEError Bases: :py:obj:`Exception` Exception raised for DSSE operations errors. .. py:class:: DSSE(body: str | bytes, payload_type: str) DSSE: Dead Simple Signing Envelope. The current implementation relies on openssl tool. .. py:property:: payload :type: str Return the content to sign as base64 string. :return: a base64 string representing the content .. py:property:: pae :type: bytes Return the Pre-Authentication Encoding. This is the content that is really signed .. py:method:: sign(key_id: str, private_key: str) -> str Sign the payload using openssl X509 certificate. :param key_id: the key id (used by end-user to identify which key to use for verification). :param private_key: path to file containing the private key :return: return the signature as base64 string .. py:method:: verify(certificate: str) -> bool Preliminary check on the signature. The current algorithm is to check that at least one signature correspond to the certificate given as parameter. This part should be improved :param certificate: path to the certificate containing the public key :return: True if one of the signature can be checked with the certificate .. py:method:: as_dict() -> dict Return the dict representing the DSSE envelope. .. py:method:: as_json() -> str Return the DSSE envelope. .. py:method:: load_json(envelope: str) -> DSSE :classmethod: Load a json DSSE string and return a Python DSSE object. :param envelope: the json envelope .. py:method:: load_dict(envelope: dict) -> DSSE :classmethod: Load a dict and return a Python DSSE object. :param envelope: the json envelope