user6734503
user6734503

Reputation:

context.load_cert_chain and 'OSError: [Errno 22] Invalid argument'

I have an issue, which I can't solve alone

What I try to do:
I want to program a https (SSL) webserver for my future project.

What I have done:
Nothing, because of this error

Problem description:
To test SSL I copied the SSL webserver code from the python documentation.
I created a certification and a private key and then I ran my program and got the following error after typing in my passphrase I've set up before in the private key:

context.load_cert_chain(certfile="cert.pem", keyfile="private.pem")

This throws an: OSError: [Errno 22] Invalid argument after typing the passphrase for my private key

Upvotes: 3

Views: 4545

Answers (1)

Chuck Hinds
Chuck Hinds

Reputation: 19

I had the same problem. I had a password in my key file, but forgot to add the password parameter in the load.cert_chain call. The line below worked. Would have been nice if the error message was more specific instead of "OSError: [Errno 22]."

ssl_ctx.load_cert_chain("server.pem", "server.key", password="xxxxx")

Upvotes: 1

Related Questions