Skip to content

Instantly share code, notes, and snippets.

View EstebanFuentealba's full-sized avatar
:octocat:

Esteban Fuentealba EstebanFuentealba

:octocat:
View GitHub Profile
@EstebanFuentealba
EstebanFuentealba / gist:d8f2e60b2b2f1bac13ba
Last active February 22, 2019 14:24
Autenticacion en Python - Servicio de Impuestos Internos - SII
import libxml2
import xmlsec
from SOAPpy import SOAPProxy
import xml.etree.ElementTree as ET
#pip install SOAPpy
#svn checkout svn://labs.libre-entreprise.org/svnroot/pyxmlsec
TEMPLATE_XML_SEMILLA = """<?xml version="1.0"?><getToken><item><Semilla>{semilla}</Semilla></item><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue/></Reference></SignedInfo><SignatureValue/><KeyInfo><KeyValue><RSAKeyValue><Modulus/><Exponent/></RSAKeyValue></KeyValue><X509Data><X509Certificate/></X509Data></KeyInfo></Signature></getToken>"""