8

while trying to do a requests call on a in-house web-service, I am getting the following error message, whereas I have put in the PEM certificate file and have specified it r = requests.get(url, cert=cert)

and the error response I get is

raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL] PEM lib (_ssl.c:2603)

I dont have access to export the private key for personal certificate which might help in resolving this issue. Is there any other way to bypass it or point it to the certificate and provide authentication? The url opens up in browser from my computer totally fine without asking for user credentials or anything for authorization.

charsi
  • 399
  • 1
  • 5
  • 13
  • 2
    Possible duplicate of [What does "SSLError: \[SSL\] PEM lib (\_ssl.c:2532)" mean using the Python ssl library?](https://stackoverflow.com/questions/30109449/what-does-sslerror-ssl-pem-lib-ssl-c2532-mean-using-the-python-ssl-libr) – rafalmp Jul 24 '17 at 22:19
  • you are probably right, but actually I dont have the access to export private for my personal computer's certificate. Can there be any other way to point it to my local certificate so it handles the private key and the authentication and authorization? – charsi Jul 25 '17 at 13:31
  • 1
    Sorry my bad I missed the `python-2.7` tag, if you look at [https://github.com/python/cpython/blob/2.7/Modules/_ssl.c#L2595](https://github.com/python/cpython/blob/2.7/Modules/_ssl.c#L2595) you'll see the exception is raised from the `_password_callback()` function, which would suggest that your cert is password protected and you have to supply that password. – rafalmp Jul 25 '17 at 14:12
  • Thanks man! so I can provide my domain credentials to this function along with the certificate? would you be able to help me with that? – charsi Jul 25 '17 at 14:16
  • 1
    See [this feature request](https://github.com/requests/requests/issues/1573) on Github - if I'm not mistaken, it's not (and probably will not be) implemented, I'm afraid. – rafalmp Jul 25 '17 at 14:32
  • so I would have to move to v3.3 to get this working? do you think there might be any other turn around way for this to work? – charsi Jul 25 '17 at 15:54
  • Maybe just use pycurl as per [this comment](https://github.com/requests/requests/issues/1573#issuecomment-169916326) instead of requests? – rafalmp Jul 25 '17 at 20:59
  • the thing is I dont have the private key, but do have the credentials. pycurl is asking for the private key. – charsi Jul 26 '17 at 14:13

0 Answers0