Ensuring that private key is in string format before it gets stored (#504)
* Ensuring that private key is in string format before it gets stored * Fixing failing test.
This commit is contained in:
parent
3f2691c5d4
commit
851d74da3d
@ -401,6 +401,9 @@ def create_csr(**csr_config):
|
||||
encryption_algorithm=serialization.NoEncryption()
|
||||
)
|
||||
|
||||
if isinstance(private_key, bytes):
|
||||
private_key = private_key.decode('utf-8')
|
||||
|
||||
csr = request.public_bytes(
|
||||
encoding=serialization.Encoding.PEM
|
||||
)
|
||||
|
@ -318,7 +318,6 @@ def test_extended_key_usage_schema():
|
||||
def test_create_basic_csr(client):
|
||||
from cryptography import x509
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from lemur.certificates.service import create_csr
|
||||
csr_config = dict(
|
||||
common_name='example.com',
|
||||
@ -332,7 +331,6 @@ def test_create_basic_csr(client):
|
||||
)
|
||||
csr, pem = create_csr(**csr_config)
|
||||
|
||||
private_key = serialization.load_pem_private_key(pem, password=None, backend=default_backend())
|
||||
csr = x509.load_pem_x509_csr(csr, default_backend())
|
||||
for name in csr.subject:
|
||||
assert name.value in csr_config.values()
|
||||
|
Loading…
Reference in New Issue
Block a user