|
|
@ -2,8 +2,7 @@ |
|
|
# © 2016 Danimar Ribeiro, Trustcode |
|
|
# © 2016 Danimar Ribeiro, Trustcode |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from uuid import uuid4 |
|
|
|
|
|
|
|
|
import tempfile |
|
|
from OpenSSL import crypto |
|
|
from OpenSSL import crypto |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -13,7 +12,7 @@ class Certificado(object): |
|
|
self.password = password |
|
|
self.password = password |
|
|
|
|
|
|
|
|
def save_pfx(self): |
|
|
def save_pfx(self): |
|
|
pfx_temp = '/tmp/' + uuid4().hex |
|
|
|
|
|
|
|
|
pfx_temp = tempfile.mkstemp()[1] |
|
|
arq_temp = open(pfx_temp, 'wb') |
|
|
arq_temp = open(pfx_temp, 'wb') |
|
|
arq_temp.write(self.pfx) |
|
|
arq_temp.write(self.pfx) |
|
|
arq_temp.close() |
|
|
arq_temp.close() |
|
|
@ -32,8 +31,8 @@ def extract_cert_and_key_from_pfx(pfx, password): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def save_cert_key(cert, key): |
|
|
def save_cert_key(cert, key): |
|
|
cert_temp = '/tmp/' + uuid4().hex |
|
|
|
|
|
key_temp = '/tmp/' + uuid4().hex |
|
|
|
|
|
|
|
|
cert_temp = tempfile.mkstemp()[1] |
|
|
|
|
|
key_temp = tempfile.mkstemp()[1] |
|
|
|
|
|
|
|
|
arq_temp = open(cert_temp, 'w') |
|
|
arq_temp = open(cert_temp, 'w') |
|
|
arq_temp.write(cert) |
|
|
arq_temp.write(cert) |
|
|
|