Reputation: 1046
Here is my code:
import ssl
def main():
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load_cert_chain(certfile=os.path.join('keys', 'server.crt'),
keyfile=os.path.join('keys', 'server.key'),
password="my certificate password")
# more code to follow
if __name__ == '__main__':
main()
I have confirmed that my two files look like:
-----BEGIN RSA PRIVATE KEY-----
# my key file
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
# my cert file
-----END CERTIFICATE-----
It was hanging on the context.load_cert_chain(...) line. No exceptions are thrown and it never returns. It turns out it was missing the password parameter (for the certificate)
Upvotes: 1
Views: 1349
Reputation: 1046
I have edited the code, adding the missing password parameter thanks to Steffen Ullrich
Upvotes: 1