forked from elmau/empresa-libre
Verificar cancelación con certificados en CD
This commit is contained in:
parent
f84721716c
commit
5a24bc159d
|
@ -28,7 +28,17 @@ class SATCertificate(object):
|
||||||
self._init_values()
|
self._init_values()
|
||||||
self._get_data_cer(cer)
|
self._get_data_cer(cer)
|
||||||
self._get_data_key(key, password)
|
self._get_data_key(key, password)
|
||||||
|
self._test()
|
||||||
|
|
||||||
|
def _test(self):
|
||||||
self._p = self._get_hash()
|
self._p = self._get_hash()
|
||||||
|
key = self._get_key('')
|
||||||
|
self._key_der = key.private_bytes(
|
||||||
|
encoding=serialization.Encoding.DER,
|
||||||
|
format=serialization.PrivateFormat.TraditionalOpenSSL,
|
||||||
|
encryption_algorithm=serialization.NoEncryption()
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
def _init_values(self):
|
def _init_values(self):
|
||||||
self._rfc = ''
|
self._rfc = ''
|
||||||
|
@ -45,6 +55,7 @@ class SATCertificate(object):
|
||||||
self._cer_pem = ''
|
self._cer_pem = ''
|
||||||
self._cer_txt = ''
|
self._cer_txt = ''
|
||||||
self._key_enc = b''
|
self._key_enc = b''
|
||||||
|
self._key_der = b''
|
||||||
self._p12 = b''
|
self._p12 = b''
|
||||||
self._cer_modulus = 0
|
self._cer_modulus = 0
|
||||||
self._key_modulus = 0
|
self._key_modulus = 0
|
||||||
|
|
|
@ -767,7 +767,7 @@ def _cancel_with_cert(invoice, args, auth, certificado):
|
||||||
pac = PACS[auth['pac']]()
|
pac = PACS[auth['pac']]()
|
||||||
# ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args}
|
# ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args}
|
||||||
info = {'cer': cert.cer_pem, 'key': cert.key_pem,
|
info = {'cer': cert.cer_pem, 'key': cert.key_pem,
|
||||||
'key_enc': cert.key_enc, 'pass': cert._p.hex(), 'args': args}
|
'key_enc': cert._key_der, 'pass': cert._p.hex(), 'args': args}
|
||||||
|
|
||||||
result = pac.cancel(invoice.xml, info, auth)
|
result = pac.cancel(invoice.xml, info, auth)
|
||||||
if pac.error:
|
if pac.error:
|
||||||
|
|
Loading…
Reference in New Issue