Reputation: 137
Is there some way to wrap a socket connection with SSL using python's ssl module in python 2.6 using a pkcs#12 file? The file contains a private key and certificate. I want to use them for the client side of the connection. This post seems to hint that it may be possible but doesn't give a real definitive answer.
Upvotes: 4
Views: 8146
Reputation: 27850
Not with python's ssl module. M2Crypto can't do this also at the moment, nor does python-gnutls. If you've got openssl command available on your client machine, you can re-export that pkcs12 to pem format running the openssl command, and use the results, something like:
openssl pkcs12 -in your_pkcs.p12 -out client_certs.pem -clcerts -nokeys [password options]
openssl pkcs12 -in your_pkcs.p12 -out keys.pem -nocerts [password options]
However PKCS12 is utterly broken by design, while still popular, you should avoid it if possible.
Upvotes: 2