skillfed

backports.ssl_match_hostname

The ssl.match_hostname() function from Python 3.5

backports-ssl-match-hostname v3.7.0.1 642.6K downloads/30d#5,611 on PyPI
Permissive license Python Software Foundation License Abandoned released

What it is and what it does

This package backports the ssl.match_hostname() function from Python 3.7 to earlier Python versions. It implements RFC 2818 (and later RFC 6125) compliant hostname matching for SSL/TLS certificates, ensuring that the hostname in a server's certificate matches the hostname you are connecting to—a critical security check for encrypted connections.

The function was introduced in Python 3.2 and has been part of the standard library ever since. This backport was designed for projects supporting older Python versions that lacked the function. However, the package has been abandoned since 2019 and is now obsolete for any project running Python 3.2 or later, which includes all modern Python versions.

Use it for:

  • Validating SSL certificates in legacy Python 2.x applications that need hostname verification before Python 3.2 was available.
  • Ensuring secure HTTPS connections in older Python codebases by checking certificate hostnames match the target server.
  • Porting Python 3.x code to run on Python 2.4–2.7 while maintaining SSL security checks.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides the ssl.match_hostname() function for validating that a server's SSL certificate hostname matches the hostname being connected to, backported from Python 3.7 for use on earlier Python versions.

No. This package is abandoned (last release 2019-01-12) and unnecessary for any modern Python project. Python 3.2+ includes match_hostname() in the standard library; Python 2.x is end-of-life. Install only if maintaining legacy Python 2.x code that cannot be upgraded—otherwise use the built-in ssl.match_hostname().

Install

backports-ssl-match-hostname on PyPI

pip

pip install backports-ssl-match-hostname

uv

uv add backports-ssl-match-hostname

poetry

poetry add backports-ssl-match-hostname

Installing backports.ssl_match_hostname

Before you install

The package is abandoned as of 2019-01-12 and has not been updated in 2771 days. Modern Python versions (3.2+) include match_hostname() in the standard library, making this backport unnecessary for current projects. High install friction due to its age and obsolescence.

License in practice

Licensed under the Python Software Foundation License (permissive), which poses no restrictions on use or redistribution.

Quickstart

from backports.ssl_match_hostname import match_hostname, CertificateError
import ssl

sslsock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_SSLv23,
                          cert_reqs=ssl.CERT_REQUIRED, ca_certs=...)
try:
    match_hostname(sslsock.getpeercert(), hostname)
except CertificateError:
    pass

Only needed for Python versions earlier than 3.2; modern Python includes match_hostname() in the standard library ssl module.

Verify before relying

  • Whether this package is still maintained or if it has been formally deprecated in favor of the standard library.
  • Whether any security patches have been applied since the last release in 2019.

Package facts

License Python Software Foundation License (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 2,771 days since the last release
First released
Downloads 642,635/month — #5,611 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: backports.ssl_match_hostname-3.7.0.1.tar.gz

Development Status :: 5 - Production/StableLicense :: OSI Approved :: Python Software Foundation LicenseProgramming Language :: Python :: 2.4Programming Language :: Python :: 2.5Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.0Programming Language :: Python :: 3.1Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Topic :: Security :: Cryptography

Tags

ssl certificate hostname validationmatch_hostname backportssl certificate verificationhostname matching sslpython ssl certificate checkrfc 2818 hostname matching
legacy-pythonssl-tlsdeprecated

More Cryptography packages