diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index d41a239a..37363b0c 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -887,7 +887,7 @@ class CertificateExport(AuthenticatedResource): extension, passphrase, data = plugin.export(cert.body, cert.chain, cert.private_key, options) # we take a hit in message size when b64 encoding - return dict(extension=extension, passphrase=passphrase, data=base64.b64encode(data)) + return dict(extension=extension, passphrase=passphrase, data=base64.b64encode(data).decode('utf-8')) api.add_resource(CertificatesList, '/certificates', endpoint='certificates') diff --git a/lemur/plugins/lemur_cryptography/plugin.py b/lemur/plugins/lemur_cryptography/plugin.py index 1c8681c3..e3058424 100644 --- a/lemur/plugins/lemur_cryptography/plugin.py +++ b/lemur/plugins/lemur_cryptography/plugin.py @@ -51,7 +51,7 @@ def build_root_certificate(options): cert_pem = cert.public_bytes( encoding=serialization.Encoding.PEM - ) + ).decode('utf-8') private_key_pem = private_key.private_bytes( encoding=serialization.Encoding.PEM, @@ -82,7 +82,7 @@ def issue_certificate(csr, options): builder = builder.serial_number(int(uuid.uuid4())) private_key = serialization.load_pem_private_key( - options['authority'].authority_certificate.private_key, + bytes(options['authority'].authority_certificate.private_key, 'utf-8'), password=None, backend=default_backend() ) @@ -91,7 +91,7 @@ def issue_certificate(csr, options): return cert.public_bytes( encoding=serialization.Encoding.PEM - ) + ).decode('utf-8') class CryptographyIssuerPlugin(IssuerPlugin): diff --git a/lemur/plugins/lemur_openssl/plugin.py b/lemur/plugins/lemur_openssl/plugin.py index 2bf22087..366b3361 100644 --- a/lemur/plugins/lemur_openssl/plugin.py +++ b/lemur/plugins/lemur_openssl/plugin.py @@ -60,7 +60,10 @@ def create_pkcs12(cert, chain, p12_tmp, key, alias, passphrase): # Create PKCS12 keystore from private key and public certificate with mktempfile() as cert_tmp: with open(cert_tmp, 'w') as f: - f.writelines([cert.strip() + "\n", chain.strip() + "\n"]) + if chain: + f.writelines([cert.strip() + "\n", chain.strip() + "\n"]) + else: + f.writelines([cert.strip() + "\n"]) run_process([ "openssl", diff --git a/lemur/static/app/angular/domains/view/view.tpl.html b/lemur/static/app/angular/domains/view/view.tpl.html index d202ffbd..664b4c38 100644 --- a/lemur/static/app/angular/domains/view/view.tpl.html +++ b/lemur/static/app/angular/domains/view/view.tpl.html @@ -1,7 +1,7 @@