An implementation of xades bes sri python to sign XML documents for e-invoicing.
- lxml
- cryptography
- xml
pip install git+https://github.com/jsonfm/[email protected]
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)
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)
Project Inspired by xades-bes-sri-ec
created by @alfredo138923. Thanks.