XML Signer¶
- class pynfse_nacional.xml_signer.XMLSignerService¶
Bases:
objectSign XML documents with ICP-Brasil certificate.
- __init__(cert_path, cert_password)¶
- Parameters:
cert_path (str)
cert_password (str)
- sign(xml)¶
Sign XML document with certificate.
Locates the signed info element (infDPS for DPS, infPedReg for events) and produces an enveloped signature referencing its Id attribute. Per the XSD schema, the Signature element is a sibling of the info element.
- Parameters:
xml (str)
- Return type:
str
- sign_and_encode(xml)¶
Sign XML, compress with GZip, and encode with Base64.
- Parameters:
xml (str)
- Return type:
str
- static compress_encode(data)¶
Compress with GZip and encode with Base64.
- Parameters:
data (str)
- Return type:
str