Skip to content

Conversation

@udokmeci-eiq
Copy link

Fix #90 SSL Context verification purpose with client SSL authentication

Issue

When making HTTPS requests, the following error occurred:

urllib.error.URLError: <urlopen error Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:809)>

This issue was caused by an incorrect SSL context configuration, where ssl.Purpose.CLIENT_AUTH was used instead of ssl.Purpose.SERVER_AUTH.


Root Cause

  • ssl.Purpose.CLIENT_AUTH is intended for servers verifying client certificates, not for clients verifying a server’s certificate.
  • Since this is a client-side HTTPS request, it should use ssl.Purpose.SERVER_AUTH.

Solution

Updated the SSL context creation to use ssl.Purpose.SERVER_AUTH:

…te a client socket with a PROTOCOL_TLS_SERVER context
@eric-eclecticiq
Copy link
Contributor

Could you add a note in CHANGES.rst ?

Copy link

@jamesoc-eiq jamesoc-eiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot Authenticate Server

3 participants