Skip to content

Commit

Permalink
Switch to using cryptography privatekeys
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks authored Dec 1, 2024
1 parent 9266e78 commit ac44537
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/trustme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,9 @@ def configure_cert(self, ctx: Union[ssl.SSLContext, OpenSSL.SSL.Context]) -> Non
with self.private_key_and_cert_chain_pem.tempfile() as path:
ctx.load_cert_chain(path)
elif _smells_like_pyopenssl(ctx):
from OpenSSL.crypto import FILETYPE_PEM, load_certificate, load_privatekey
from OpenSSL.crypto import FILETYPE_PEM, load_certificate

key = load_privatekey(FILETYPE_PEM, self.private_key_pem.bytes())
key = load_pem_private_key(self.private_key_pem.bytes(), None)
ctx.use_privatekey(key)
cert = load_certificate(FILETYPE_PEM, self.cert_chain_pems[0].bytes())
ctx.use_certificate(cert)
Expand Down

0 comments on commit ac44537

Please sign in to comment.