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


Python x509.PrecertPoison方法代码示例

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


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

示例1: _create_x509_extension

# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import PrecertPoison [as 别名]
def _create_x509_extension(self, handlers, extension):
        if isinstance(extension.value, x509.UnrecognizedExtension):
            value = _encode_asn1_str_gc(self, extension.value.value)
            return self._create_raw_x509_extension(extension, value)
        elif isinstance(extension.value, x509.TLSFeature):
            asn1 = encode_der(
                SEQUENCE,
                *[
                    encode_der(INTEGER, encode_der_integer(x.value))
                    for x in extension.value
                ]
            )
            value = _encode_asn1_str_gc(self, asn1)
            return self._create_raw_x509_extension(extension, value)
        elif isinstance(extension.value, x509.PrecertPoison):
            value = _encode_asn1_str_gc(self, encode_der(NULL))
            return self._create_raw_x509_extension(extension, value)
        else:
            try:
                encode = handlers[extension.oid]
            except KeyError:
                raise NotImplementedError(
                    'Extension not supported: {}'.format(extension.oid)
                )

            ext_struct = encode(self, extension.value)
            nid = self._lib.OBJ_txt2nid(
                extension.oid.dotted_string.encode("ascii")
            )
            backend.openssl_assert(nid != self._lib.NID_undef)
            return self._lib.X509V3_EXT_i2d(
                nid, 1 if extension.critical else 0, ext_struct
            ) 
开发者ID:tp4a,项目名称:teleport,代码行数:35,代码来源:backend.py

示例2: __init__

# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import PrecertPoison [as 别名]
def __init__(self, value=None):
        super().__init__(value=value)

        if self.critical is not True:
            raise ValueError('PrecertPoison must always be marked as critical') 
开发者ID:mathiasertl,项目名称:django-ca,代码行数:7,代码来源:extensions.py

示例3: test_critical

# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import PrecertPoison [as 别名]
def test_critical(self):
        with self.assertRaisesRegex(ValueError, r'^PrecertPoison must always be marked as critical$'):
            PrecertPoison({'critical': False}) 
开发者ID:mathiasertl,项目名称:django-ca,代码行数:5,代码来源:tests_extensions.py

示例4: _create_x509_extension

# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import PrecertPoison [as 别名]
def _create_x509_extension(self, handlers, extension):
        if isinstance(extension.value, x509.UnrecognizedExtension):
            value = _encode_asn1_str_gc(self, extension.value.value)
            return self._create_raw_x509_extension(extension, value)
        elif isinstance(extension.value, x509.TLSFeature):
            asn1 = _Integers([x.value for x in extension.value]).dump()
            value = _encode_asn1_str_gc(self, asn1)
            return self._create_raw_x509_extension(extension, value)
        elif isinstance(extension.value, x509.PrecertPoison):
            asn1 = asn1crypto.core.Null().dump()
            value = _encode_asn1_str_gc(self, asn1)
            return self._create_raw_x509_extension(extension, value)
        else:
            try:
                encode = handlers[extension.oid]
            except KeyError:
                raise NotImplementedError(
                    'Extension not supported: {}'.format(extension.oid)
                )

            ext_struct = encode(self, extension.value)
            nid = self._lib.OBJ_txt2nid(
                extension.oid.dotted_string.encode("ascii")
            )
            backend.openssl_assert(nid != self._lib.NID_undef)
            return self._lib.X509V3_EXT_i2d(
                nid, 1 if extension.critical else 0, ext_struct
            ) 
开发者ID:aws-quickstart,项目名称:quickstart-redhat-openshift,代码行数:30,代码来源:backend.py


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