This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ahasenack
Recipients ahasenack, gvanrossum, janssen
Date 2007-12-12.12:48:23
SpamBayes Score 0.27075186
Marked as misclassified No
Message-id <>
At the least it should be made clear in the documentation that the
hostname is not checked against the commonName nor the subjectAltName
fields of the server certificate. And add some sample code to the
documentation for doing a simple check. Something like this, to illustrate:

def get_subjectAltName(cert):
        if not cert.has_key('subjectAltName'):
                return []
        ret = []
        for rdn in cert['subjectAltName']:
                if rdn[0].lower() == 'dns' or rdn[0][:2].lower() == 'ip':
        return ret

def get_commonName(cert):
        if not cert.has_key('subject'):
                return []
        ret = []
        for rdn in cert['subject']:
                if rdn[0][0].lower() == 'commonname':
        return ret

def verify_hostname(cert, host):
        cn = get_commonName(cert)
        san = get_subjectAltName(cert)
        return (host in cn) or (host in san)
Date User Action Args
2007-12-12 12:48:25ahasenacksetspambayes_score: 0.270752 -> 0.27075186
recipients: + ahasenack, gvanrossum, janssen
2007-12-12 12:48:24ahasenacksetspambayes_score: 0.270752 -> 0.270752
messageid: <>
2007-12-12 12:48:24ahasenacklinkissue1589 messages
2007-12-12 12:48:23ahasenackcreate