Python cryptography.x509.PrecertPoison() Examples
The following are 7
code examples of cryptography.x509.PrecertPoison().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cryptography.x509
, or try the search function
.
Example #1
Source File: backend.py From teleport with Apache License 2.0 | 5 votes |
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 )
Example #2
Source File: backend.py From teleport with Apache License 2.0 | 5 votes |
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 )
Example #3
Source File: backend.py From learn_python3_spider with MIT License | 5 votes |
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 )
Example #4
Source File: extensions.py From django-ca with GNU General Public License v3.0 | 5 votes |
def __init__(self, value=None): super().__init__(value=value) if self.critical is not True: raise ValueError('PrecertPoison must always be marked as critical')
Example #5
Source File: tests_extensions.py From django-ca with GNU General Public License v3.0 | 5 votes |
def test_critical(self): with self.assertRaisesRegex(ValueError, r'^PrecertPoison must always be marked as critical$'): PrecertPoison({'critical': False})
Example #6
Source File: backend.py From quickstart-redhat-openshift with Apache License 2.0 | 5 votes |
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 )
Example #7
Source File: backend.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
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 )