Last active
August 29, 2015 14:24
-
-
Save alcidesrivera/b2f59a81318c81bd5087 to your computer and use it in GitHub Desktop.
Xades
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Xades(object): | |
def apply_digital_signature(self, xml_document, file_pk12, password): | |
""" | |
Metodo que aplica la firma digital al XML | |
""" | |
JAR_PATH = 'firma/firmaXadesBes.jar' | |
JAVA_CMD = 'java' | |
ds_document = False | |
xml_str = etree.tostring(xml_document, encoding='utf8', method='xml') | |
# firma electrónica del xml | |
firma_path = os.path.join(os.path.dirname(__file__), JAR_PATH) | |
# invocación del jar de la firma electrónica | |
p = Popen([JAVA_CMD, '-jar', firma_path, xml_str, file_pk12, password], stdout=PIPE, stderr=STDOUT) | |
return p.communicate()[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment