Replace pycrypto with cryptography in snakeoil
pycrypto is no longer maintained [1]. This patch rewrites functions using pycrypto and replaces them with the cryptography equivalent [1] http://lists.openstack.org/pipermail/openstack-dev/2017-March/113568 Change-Id: Icf89aa75ab701cca5b903345b6349b80c394a6c9
This commit is contained in:
parent
9ac0a0910e
commit
a3dea80700
@ -16,7 +16,8 @@
|
||||
import base64
|
||||
import os
|
||||
|
||||
from Crypto.Util import asn1
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography import x509
|
||||
import fixtures
|
||||
import mock
|
||||
from OpenSSL import crypto
|
||||
@ -148,13 +149,13 @@ class CertManagerTestCase(BaseTestCase):
|
||||
key_size=512, subject_dn=subject_dn)
|
||||
|
||||
def verify_sig(self, encoded_cert):
|
||||
der = asn1.DerSequence()
|
||||
der.decode(encoded_cert)
|
||||
der_sig = asn1.DerObject()
|
||||
der_sig.decode(der[2])
|
||||
sig = der_sig.payload
|
||||
self.assertEqual(b'\x00', sig[:1])
|
||||
crypto.verify(self.ca.cert, sig[1:], der[0], 'sha256')
|
||||
cert = x509.load_der_x509_certificate(encoded_cert, default_backend())
|
||||
|
||||
crypto.verify(
|
||||
self.ca.cert,
|
||||
cert.signature,
|
||||
cert.tbs_certificate_bytes,
|
||||
'sha256')
|
||||
|
||||
def test_gen_cert_no_file_storage(self):
|
||||
req = certificate_utils.get_valid_csr_object()
|
||||
|
Loading…
Reference in New Issue
Block a user