MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _ipaddress_match

Function _ipaddress_match

tools/python-3.11.9-amd64/Lib/ssl.py:364–373  ·  view source on GitHub ↗

Exact matching of IP addresses. RFC 6125 explicitly doesn't define an algorithm for this (section 1.7.2 - "Out of Scope").

(cert_ipaddress, host_ip)

Source from the content-addressed store, hash-verified

362
363
364def _ipaddress_match(cert_ipaddress, host_ip):
365 """Exact matching of IP addresses.
366
367 RFC 6125 explicitly doesn't define an algorithm for this
368 (section 1.7.2 - "Out of Scope").
369 """
370 # OpenSSL may add a trailing newline to a subjectAltName's IP address,
371 # commonly with IPv6 addresses. Strip off trailing \n.
372 ip = _inet_paton(cert_ipaddress.rstrip())
373 return ip == host_ip
374
375
376def match_hostname(cert, hostname):

Callers 1

match_hostnameFunction · 0.70

Calls 2

_inet_patonFunction · 0.85
rstripMethod · 0.45

Tested by

no test coverage detected