How to do mutual certificate authentication with httplib2

后端 未结 2 1532
感动是毒
感动是毒 2021-02-09 03:14

I\'m using httplib2 to make a request from my server to another web service. We want to use mutual certificate authentication. I see how to use a certificate for the outgoing

2条回答
  •  天涯浪人
    2021-02-09 03:49

    perhaps things have changed since your question, I am able to do mutual authentication with httplib2 v0.7, as below:

    import httplib2
    
    h=httplib2.Http(ca_certs='ca.crt')
    h.add_certificate(key='client_private_key.pem', cert='cert_client.pem', domain='')
    try: resp, cont = h.request('https://mytest.com/cgi-bin/test.cgi')
    except Exception as e: print e
    

    Note the domain='' argument, this is the only way I could make it work

提交回复
热议问题