Skip to content

Latest commit

 

History

History
51 lines (30 loc) · 944 Bytes

README.md

File metadata and controls

51 lines (30 loc) · 944 Bytes

🧾⚡️ XADES BES SRI

An implementation of xades bes sri python to sign XML documents for e-invoicing.

⚙️ Technologies

  • lxml
  • cryptography
  • xml

📦 Installation

pip install git+https://github.com/jsonfm/xades-bes-sri@0.1.0

✨ Read .p12 file

from xadessri import get_private_key


with open("/signature.p12", mode="rb") as file:
    p12 = file.read() # bytes


p12 = get_private_key(p12, "password")
print(p12.key)
print(p12.cert)

✨ Sign a XML

from xadessri import sign_xml


with open("/signature.p12", mode="rb") as file:
    p12 = file.read() # bytes


xml = """<xml><data>some important data</data></xml>"""

signed = sign_xml(p12, "password", xml)

print("signed: ", signed)

🔆 Credits

Project Inspired by xades-bes-sri-ec created by @alfredo138923. Thanks.