Quitar p12
This commit is contained in:
parent
93fa2fb624
commit
b06a2c0ffb
|
@ -15,7 +15,6 @@ from cryptography.x509.oid import ExtensionOID
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
from cryptography.hazmat.primitives.asymmetric import padding
|
||||||
|
|
||||||
|
|
||||||
from conf import TOKEN
|
from conf import TOKEN
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,17 +126,13 @@ class SATCertificate(object):
|
||||||
)
|
)
|
||||||
return key_pem
|
return key_pem
|
||||||
|
|
||||||
def get_encrypt(self, password):
|
# Not work
|
||||||
key_enc = self._key_enc
|
def _get_p12(self):
|
||||||
if password:
|
obj = serialization.pkcs12.serialize_key_and_certificates('test',
|
||||||
p = password.encode()
|
self.key_pem, self.cer_pem, None,
|
||||||
obj = self._get_key('')
|
encryption_algorithm=serialization.NoEncryption()
|
||||||
key_enc = obj.private_bytes(
|
|
||||||
encoding=serialization.Encoding.PEM,
|
|
||||||
format=serialization.PrivateFormat.PKCS8,
|
|
||||||
encryption_algorithm=serialization.BestAvailableEncryption(p)
|
|
||||||
)
|
)
|
||||||
return key_enc
|
return obj
|
||||||
|
|
||||||
def sign(self, data, password=''):
|
def sign(self, data, password=''):
|
||||||
private_key = self._get_key(password)
|
private_key = self._get_key(password)
|
||||||
|
@ -202,6 +197,10 @@ class SATCertificate(object):
|
||||||
def key_enc(self):
|
def key_enc(self):
|
||||||
return self._key_enc
|
return self._key_enc
|
||||||
|
|
||||||
|
@property
|
||||||
|
def p12(self):
|
||||||
|
return self._get_p12()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def error(self):
|
def error(self):
|
||||||
return self._error
|
return self._error
|
||||||
|
@ -236,7 +235,6 @@ def main(args):
|
||||||
print(cert.error)
|
print(cert.error)
|
||||||
else:
|
else:
|
||||||
print(cert)
|
print(cert)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue