Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSLV3_ALERT_HANDSHAKE_FAILURE #57

Open
morindo opened this issue Jul 18, 2024 · 3 comments
Open

SSLV3_ALERT_HANDSHAKE_FAILURE #57

morindo opened this issue Jul 18, 2024 · 3 comments

Comments

@morindo
Copy link

morindo commented Jul 18, 2024

Hi, I'm getting a SSLV3_ALERT_HANDSHAKE_FAILURE when trying to use my pfx certificate and make a request to a site. I tried a couple of ssl_protocol without success.

This is my code:

def download_a_file(date: pendulum.DateTime):
    # URL to download the PDF file.
    url = f"https://fakesite.com/portalDownload/invoices/file?date={date.format("YYYYMMDD")}&format=pdf"

    pfx_path = "C:/mycertificate.pfx"
    pfx_password = "FakePass123"

    with Session() as s:
        s.mount(
            "https://fakesite.com",
            Pkcs12Adapter(pkcs12_filename=pfx_path, pkcs12_password=pfx_password),
        )
        response = s.get(url)

    if response.status_code == 200:
        context.log.info("Successfully downloaded the PDF file.")
        return response.content
    else:
        context.log.error("Failed to download the PDF file.")
requests.exceptions.SSLError: HTTPSConnectionPool(host='fakesite.com', port=443): Max retries exceeded with url: /marketportal/ (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1000)')))

I'm on Windows 11, python 3.12 using requests_pkcs12 version 1.25.

Using my certificate in Chrome, Edge or Firefox is working when login in the site.

This is what I'm getting from Chrome Developer Tools->Security tab.

image

Am I doing something wrong?

Thank you,

@morindo
Copy link
Author

morindo commented Jul 19, 2024

Still searching for a fix. I think it's probably related to this requests issue psf/requests#6715 (comment).

@xli1205
Copy link

xli1205 commented Aug 6, 2024

If you use Python 3.9 or below, this issue will not occur.

@vog
Copy link
Member

vog commented Aug 13, 2024

Up to Python 3.11 I can't see any issues, either. I'll test with Python 3.12 later.

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

No branches or pull requests

3 participants