Verificar cancelación con certificados en CD

This commit is contained in:
El Mau 2022-01-22 21:35:53 -06:00
parent f84721716c
commit 5a24bc159d
2 changed files with 12 additions and 1 deletions

View File

@ -28,7 +28,17 @@ class SATCertificate(object):
self._init_values()
self._get_data_cer(cer)
self._get_data_key(key, password)
self._test()
def _test(self):
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):
self._rfc = ''
@ -45,6 +55,7 @@ class SATCertificate(object):
self._cer_pem = ''
self._cer_txt = ''
self._key_enc = b''
self._key_der = b''
self._p12 = b''
self._cer_modulus = 0
self._key_modulus = 0

View File

@ -767,7 +767,7 @@ def _cancel_with_cert(invoice, args, auth, certificado):
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,
'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)
if pac.error: