Ensure the openssl and cryptography work under python3. (#438)

This commit is contained in:
kevgliss 2016-10-09 00:06:15 -07:00 committed by GitHub
parent a19c918c68
commit 72a390c563
4 changed files with 9 additions and 6 deletions

View File

@ -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')

View File

@ -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):

View File

@ -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",

View File

@ -1,7 +1,7 @@
<div class="row">
<div class="col-md-12">
<h2 class="featurette-heading">Domains
<span class="text-muted"><small>Zone transfers as scary</small></span></h2>
<span class="text-muted"><small>Zone transfers are scary</small></span></h2>
<div class="panel panel-default">
<div class="panel-heading">
<div class="btn-group pull-right">