dcclib.signature

DCCSigner

DCCSigner(key: str, cert: str)

Class to sign XML files with a private key and certificate.

Create a new DCCSigner. @param key: the private key @param cert: the full certificate chain, including intermediate certificates, in PEM format.

sign_path

sign_path(path: str) -> etree.Element

Sign an XML file. @param path: the path to the XML file @return: the signed XML tree @raise Exception: if the XML could not be signed

sign_str

sign_str(xml: str) -> etree.Element

Sign an XML string. @param xml: the XML string to sign @return: the signed XML string @raise Exception: if the XML could not be signed

sign_tree

sign_tree(xml_tree: etree.Element) -> etree.Element

Sign an XML tree. @param xml_tree: the XML tree to sign @return: the signed XML tree @raise Exception: if the XML could not be signed

DCCVerifier

DCCVerifier(ca_pem_file: str = None)

Class to verify XML files.

Create a new DCCVerifier. @param ca_pem_file: the path to the CA PEM file @warning: by default, the systems CA certificates are used. See here: https://xml-security.github.io/signxml#verifying-saml-assertions

verify_path

verify_path(path: str)

Verify an XML file. @param path: the path to the XML file @return: the verification result @raise Exception: if the XML could not be verified @warning: signxml is used to verify the XML. See the security recommendations here: https://xml-security.github.io/signxml/#signxml.XMLVerifier

verify_str

verify_str(xml: str)

Verify an XML string. @param xml: the XML string to verify @return: the verification result @raise Exception: if the XML could not be verified @warning: signxml is used to verify the XML. See the security recommendations here: https://xml-security.github.io/signxml/#signxml.XMLVerifier

verify_tree

verify_tree(xml_tree: etree.Element) -> DCCVerifyResult

Verify an XML tree. @param xml_tree: the XML tree to verify @return: the verification result @raise Exception: if the XML could not be verified @warning: signxml is used to verify the XML. See the security recommendations here: https://xml-security.github.io/signxml/#signxml.XMLVerifier

DCCVerifyResult

DCCVerifyResult(signed_tree: etree.Element, signature_tree: etree.Element, cert: x509.Certificate)

Class to represent the result of a verification.

Create a new DCCVerifyResult. @param signed_tree: the tree of the signed XML @param signature_tree: the tree of the signature @param cert: the certificate used for signing

signature

DCCSigner

DCCSigner(key: str, cert: str)

Class to sign XML files with a private key and certificate.

Create a new DCCSigner. @param key: the private key @param cert: the full certificate chain, including intermediate certificates, in PEM format.

sign_path

sign_path(path: str) -> etree.Element

Sign an XML file. @param path: the path to the XML file @return: the signed XML tree @raise Exception: if the XML could not be signed

sign_str

sign_str(xml: str) -> etree.Element

Sign an XML string. @param xml: the XML string to sign @return: the signed XML string @raise Exception: if the XML could not be signed

sign_tree

sign_tree(xml_tree: etree.Element) -> etree.Element

Sign an XML tree. @param xml_tree: the XML tree to sign @return: the signed XML tree @raise Exception: if the XML could not be signed

DCCVerifier

DCCVerifier(ca_pem_file: str = None)

Class to verify XML files.

Create a new DCCVerifier. @param ca_pem_file: the path to the CA PEM file @warning: by default, the systems CA certificates are used. See here: https://xml-security.github.io/signxml#verifying-saml-assertions

verify_path

verify_path(path: str)

Verify an XML file. @param path: the path to the XML file @return: the verification result @raise Exception: if the XML could not be verified @warning: signxml is used to verify the XML. See the security recommendations here: https://xml-security.github.io/signxml/#signxml.XMLVerifier

verify_str

verify_str(xml: str)

Verify an XML string. @param xml: the XML string to verify @return: the verification result @raise Exception: if the XML could not be verified @warning: signxml is used to verify the XML. See the security recommendations here: https://xml-security.github.io/signxml/#signxml.XMLVerifier

verify_tree

verify_tree(xml_tree: etree.Element) -> DCCVerifyResult

Verify an XML tree. @param xml_tree: the XML tree to verify @return: the verification result @raise Exception: if the XML could not be verified @warning: signxml is used to verify the XML. See the security recommendations here: https://xml-security.github.io/signxml/#signxml.XMLVerifier

DCCVerifyResult

DCCVerifyResult(signed_tree: etree.Element, signature_tree: etree.Element, cert: x509.Certificate)

Class to represent the result of a verification.

Create a new DCCVerifyResult. @param signed_tree: the tree of the signed XML @param signature_tree: the tree of the signature @param cert: the certificate used for signing