質問

I am a client to a secured HTTPS server who has issued to me a password protected .pfx certificate to identify me to its system every-time. Using browser where I have installed the certificate (apparently only IE6 and previous versions works) i am able to log in and upload a file which i need to do on a daily basis. Right now am trying to write a Python script to do the same task and I am not sure if it is doable this way.

I am trying to use python mechanize library to connect to the server. Using OpenSSL I have broken down the .pfx file into .key and .cer PEM files. And I am using them as certificate for my python script.

Here is my code snippet

br = mechanize.Browser()

br.add_client_certificate(host,"I:/Key.key","I:/certificate.crt:")

whatever I tried it throws various SSL exception .. namely SSL_CTX_use_certificate_chain_file SSL_CTX_use_PrivateKey_file

Can anyone please tell me what possibly I could be doing wrong or if at all this is not the right approach.

役に立ちましたか?

解決

I was able to get rid of errors by ways described in this link.

It didn't solve my purpose though because the server I was trying to connect is a IIS based server and it only accepts .pfx certificates.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top