当前位置: 首页>>代码示例>>Python>>正文


Python ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT属性代码示例

本文整理汇总了Python中ndg.httpsclient.ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT属性的典型用法代码示例。如果您正苦于以下问题:Python ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT属性的具体用法?Python ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT怎么用?Python ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ndg.httpsclient.ssl_peer_verification的用法示例。


在下文中一共展示了ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_subj_alt_name

# 需要导入模块: from ndg.httpsclient import ssl_peer_verification [as 别名]
# 或者: from ndg.httpsclient.ssl_peer_verification import SUBJ_ALT_NAME_SUPPORT [as 别名]
def get_subj_alt_name(peer_cert):
    # Search through extensions
    dns_name = []
    if not SUBJ_ALT_NAME_SUPPORT:
        return dns_name

    general_names = SubjectAltName()
    for i in range(peer_cert.get_extension_count()):
        ext = peer_cert.get_extension(i)
        ext_name = ext.get_short_name()
        if ext_name != b'subjectAltName':
            continue

        # PyOpenSSL returns extension data in ASN.1 encoded form
        ext_dat = ext.get_data()
        decoded_dat = der_decoder.decode(ext_dat,
                                         asn1Spec=general_names)

        for name in decoded_dat:
            if not isinstance(name, SubjectAltName):
                continue
            for entry in range(len(name)):
                component = name.getComponentByPosition(entry)
                if component.getName() != 'dNSName':
                    continue
                dns_name.append(str(component.getComponent()))

    return dns_name 
开发者ID:deis,项目名称:controller,代码行数:30,代码来源:certificate.py

示例2: get_subj_alt_name

# 需要导入模块: from ndg.httpsclient import ssl_peer_verification [as 别名]
# 或者: from ndg.httpsclient.ssl_peer_verification import SUBJ_ALT_NAME_SUPPORT [as 别名]
def get_subj_alt_name(peer_cert):
    # Search through extensions
    dns_name = []
    if not SUBJ_ALT_NAME_SUPPORT:
        return dns_name

    general_names = SubjectAltName()
    for i in range(peer_cert.get_extension_count()):
        ext = peer_cert.get_extension(i)
        ext_name = ext.get_short_name()
        if ext_name != 'subjectAltName':
            continue

        # PyOpenSSL returns extension data in ASN.1 encoded form
        ext_dat = ext.get_data()
        decoded_dat = der_decoder.decode(ext_dat,
                                         asn1Spec=general_names)

        for name in decoded_dat:
            if not isinstance(name, SubjectAltName):
                continue
            for entry in range(len(name)):
                component = name.getComponentByPosition(entry)
                if component.getName() != 'dNSName':
                    continue
                dns_name.append(str(component.getComponent()))

    return dns_name 
开发者ID:war-and-code,项目名称:jawfish,代码行数:30,代码来源:pyopenssl.py

示例3: get_subj_alt_name

# 需要导入模块: from ndg.httpsclient import ssl_peer_verification [as 别名]
# 或者: from ndg.httpsclient.ssl_peer_verification import SUBJ_ALT_NAME_SUPPORT [as 别名]
def get_subj_alt_name(peer_cert):
    # Search through extensions
    dns_name = []
    if not SUBJ_ALT_NAME_SUPPORT:
        return dns_name

    general_names = SubjectAltName()
    for i in range(peer_cert.get_extension_count()):
        ext = peer_cert.get_extension(i)
        ext_name = ext.get_short_name()
        if ext_name.decode() != 'subjectAltName':
            continue

        # PyOpenSSL returns extension data in ASN.1 encoded form
        ext_dat = ext.get_data()
        decoded_dat = der_decoder.decode(ext_dat,
                                         asn1Spec=general_names)

        for name in decoded_dat:
            if not isinstance(name, SubjectAltName):
                continue
            for entry in range(len(name)):
                component = name.getComponentByPosition(entry)
                if component.getName() != 'dNSName':
                    continue
                dns_name.append(str(component.getComponent()))

    return dns_name 
开发者ID:syncloud,项目名称:platform,代码行数:30,代码来源:certbot_generator.py


注:本文中的ndg.httpsclient.ssl_peer_verification.SUBJ_ALT_NAME_SUPPORT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。