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


Python univ.Boolean方法代码示例

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


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

示例1: valueDecoder

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length,
                     state, decodeFun, substrateFun):
        head, tail = substrate[:length], substrate[length:]
        if not head or length != 1:
            raise error.PyAsn1Error('Not single-octet Boolean payload')
        byte = oct2int(head[0])
        # CER/DER specifies encoding of TRUE as 0xFF and FALSE as 0x0, while
        # BER allows any non-zero value as TRUE; cf. sections 8.2.2. and 11.1 
        # in http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
        if byte == 0xff:
            value = 1
        elif byte == 0x00:
            value = 0
        else:
            raise error.PyAsn1Error('Unexpected Boolean payload: %s' % byte)
        return self._createComponent(asn1Spec, tagSet, value), tail 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:18,代码来源:decoder.py

示例2: valueDecoder

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length,
                     state, decodeFun, substrateFun):
        head, tail = substrate[:length], substrate[length:]
        if not head or length != 1:
            raise error.PyAsn1Error('Not single-octet Boolean payload')
        byte = oct2int(head[0])
        # CER/DER specifies encoding of TRUE as 0xFF and FALSE as 0x0, while
        # BER allows any non-zero value as TRUE; cf. sections 8.2.2. and 11.1 
        # in http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
        if byte == 0xff:
            value = 1
        elif byte == 0x00:
            value = 0
        else:
            raise error.PyAsn1Error('Unexpected Boolean payload: %s' % byte)
        return self._createComponent(asn1Spec, tagSet, value), tail

# TODO: prohibit non-canonical encoding 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:20,代码来源:decoder.py

示例3: valueDecoder

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
        head, tail = substrate[:length], substrate[length:]
        if not head or length != 1:
            raise error.PyAsn1Error('Not single-octet Boolean payload')
        byte = oct2int(head[0])
        # CER/DER specifies encoding of TRUE as 0xFF and FALSE as 0x0, while
        # BER allows any non-zero value as TRUE; cf. sections 8.2.2. and 11.1 
        # in https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
        if byte == 0xff:
            value = 1
        elif byte == 0x00:
            value = 0
        else:
            raise error.PyAsn1Error('Unexpected Boolean payload: %s' % byte)
        return self._createComponent(asn1Spec, tagSet, value, **options), tail

# TODO: prohibit non-canonical encoding 
开发者ID:tp4a,项目名称:teleport,代码行数:22,代码来源:decoder.py

示例4: valueDecoder

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length,
                     state, decodeFun, substrateFun):
        head, tail = substrate[:length], substrate[length:]
        if not head:
            raise error.PyAsn1Error('Empty substrate')
        byte = oct2int(head[0])
        # CER/DER specifies encoding of TRUE as 0xFF and FALSE as 0x0, while
        # BER allows any non-zero value as TRUE; cf. sections 8.2.2. and 11.1 
        # in http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
        if byte == 0xff:
            value = 1
        elif byte == 0x00:
            value = 0
        else:
            raise error.PyAsn1Error('Boolean CER violation: %s' % byte)
        return self._createComponent(asn1Spec, tagSet, value), tail 
开发者ID:caronc,项目名称:nzb-subliminal,代码行数:18,代码来源:decoder.py

示例5: valueDecoder

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
        head, tail = substrate[:length], substrate[length:]
        if not head or length != 1:
            raise error.PyAsn1Error('Not single-octet Boolean payload')
        byte = oct2int(head[0])
        # CER/DER specifies encoding of TRUE as 0xFF and FALSE as 0x0, while
        # BER allows any non-zero value as TRUE; cf. sections 8.2.2. and 11.1 
        # in http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
        if byte == 0xff:
            value = 1
        elif byte == 0x00:
            value = 0
        else:
            raise error.PyAsn1Error('Unexpected Boolean payload: %s' % byte)
        return self._createComponent(asn1Spec, tagSet, value), tail

# TODO: prohibit non-canonical encoding 
开发者ID:aws-samples,项目名称:aws-kube-codesuite,代码行数:22,代码来源:decoder.py

示例6: persistent_search_control

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def persistent_search_control(change_types, changes_only=True, return_ecs=True, criticality=False):
    control_value = PersistentSearchControl()
    control_value.setComponentByName('changeTypes', Integer(change_types))
    control_value.setComponentByName('changesOnly', Boolean(changes_only))
    control_value.setComponentByName('returnECs', Boolean(return_ecs))
    return build_control('2.16.840.1.113730.3.4.3', criticality, control_value) 
开发者ID:tp4a,项目名称:teleport,代码行数:8,代码来源:persistentSearch.py

示例7: realEncode

# 需要导入模块: from pyasn1.type import univ [as 别名]
# 或者: from pyasn1.type.univ import Boolean [as 别名]
def realEncode(self, data):
            data = int(data)
            if data != 0 and data != 1:
                raise Exception("DerEncodeBoolean transformer expects 0 or 1")
            return der.encoder.encode(univ.Boolean(data)) 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:7,代码来源:ASN1.py


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