pub struct PyNameConstraintsBuilder { /* private fields */ }Expand description
Fluent builder for a NameConstraints extension value (OID 2.5.29.30,
RFC 5280 §4.2.1.10).
The NameConstraints extension restricts the namespace within which all
subject names in certificates issued by a CA must fall. Names in
permittedSubtrees are allowed; names in excludedSubtrees are
forbidden. When present in a CA certificate this extension MUST be marked
critical.
Add permitted and excluded subtrees using the typed methods, then call
:meth:build to obtain the DER bytes of the NameConstraints SEQUENCE —
the content that goes inside the OCTET STRING wrapper in the Extension
SEQUENCE.
The class is also available as the short alias synta.ext.NC.
DNS name conventions: prefix the domain with a leading dot (e.g.
".example.com") to constrain the entire subtree rooted at
example.com; omit the dot to constrain only that exact host.
IP address constraints: pass address bytes concatenated with mask bytes
— 8 bytes for IPv4 (e.g. b"\\xc0\\xa8\\x00\\x00\\xff\\xff\\x00\\x00"
for 192.168.0.0/16) or 32 bytes for IPv6.
import synta.ext as ext
# Permit example.com DNS subtree and a private IP range;
# exclude a known-bad subdomain.
nc = ext.NC() \
.permit_dns(".example.com") \
.permit_rfc822(".example.com") \
.permit_ip(b"\x0a\x00\x00\x00\xff\x00\x00\x00") \
.exclude_dns(".evil.com") \
.build()Trait Implementations§
impl DerefToPyAny for PyNameConstraintsBuilder
impl ExtractPyClassWithClone for PyNameConstraintsBuilder
Source§impl<'py> IntoPyObject<'py> for PyNameConstraintsBuilder
impl<'py> IntoPyObject<'py> for PyNameConstraintsBuilder
Source§type Target = PyNameConstraintsBuilder
type Target = PyNameConstraintsBuilder
Source§type Output = Bound<'py, <PyNameConstraintsBuilder as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyNameConstraintsBuilder as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for PyNameConstraintsBuilder
impl PyClass for PyNameConstraintsBuilder
Source§impl PyClassImpl for PyNameConstraintsBuilder
impl PyClassImpl for PyNameConstraintsBuilder
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// Fluent builder for a ``NameConstraints`` extension value (OID 2.5.29.30,
/// RFC 5280 §4.2.1.10).
///
/// The ``NameConstraints`` extension restricts the namespace within which all
/// subject names in certificates issued by a CA must fall. Names in
/// ``permittedSubtrees`` are allowed; names in ``excludedSubtrees`` are
/// forbidden. When present in a CA certificate this extension MUST be marked
/// critical.
///
/// Add permitted and excluded subtrees using the typed methods, then call
/// :meth:`build` to obtain the DER bytes of the ``NameConstraints`` SEQUENCE —
/// the content that goes inside the OCTET STRING wrapper in the ``Extension``
/// SEQUENCE.
///
/// The class is also available as the short alias ``synta.ext.NC``.
///
/// **DNS name conventions:** prefix the domain with a leading dot (e.g.
/// ``".example.com"``) to constrain the entire subtree rooted at
/// ``example.com``; omit the dot to constrain only that exact host.
///
/// **IP address constraints:** pass address bytes concatenated with mask bytes
/// — 8 bytes for IPv4 (e.g. ``b"\\xc0\\xa8\\x00\\x00\\xff\\xff\\x00\\x00"``
/// for ``192.168.0.0/16``) or 32 bytes for IPv6.
///
/// ```python,ignore
/// import synta.ext as ext
///
/// # Permit example.com DNS subtree and a private IP range;
/// # exclude a known-bad subdomain.
/// nc = ext.NC() \
/// .permit_dns(".example.com") \
/// .permit_rfc822(".example.com") \
/// .permit_ip(b"\x0a\x00\x00\x00\xff\x00\x00\x00") \
/// .exclude_dns(".evil.com") \
/// .build()
/// ```
const RAW_DOC: &'static CStr = /// Fluent builder for a ``NameConstraints`` extension value (OID 2.5.29.30, /// RFC 5280 §4.2.1.10). /// /// The ``NameConstraints`` extension restricts the namespace within which all /// subject names in certificates issued by a CA must fall. Names in /// ``permittedSubtrees`` are allowed; names in ``excludedSubtrees`` are /// forbidden. When present in a CA certificate this extension MUST be marked /// critical. /// /// Add permitted and excluded subtrees using the typed methods, then call /// :meth:`build` to obtain the DER bytes of the ``NameConstraints`` SEQUENCE — /// the content that goes inside the OCTET STRING wrapper in the ``Extension`` /// SEQUENCE. /// /// The class is also available as the short alias ``synta.ext.NC``. /// /// **DNS name conventions:** prefix the domain with a leading dot (e.g. /// ``".example.com"``) to constrain the entire subtree rooted at /// ``example.com``; omit the dot to constrain only that exact host. /// /// **IP address constraints:** pass address bytes concatenated with mask bytes /// — 8 bytes for IPv4 (e.g. ``b"\\xc0\\xa8\\x00\\x00\\xff\\xff\\x00\\x00"`` /// for ``192.168.0.0/16``) or 32 bytes for IPv6. /// /// ```python,ignore /// import synta.ext as ext /// /// # Permit example.com DNS subtree and a private IP range; /// # exclude a known-bad subdomain. /// nc = ext.NC() \ /// .permit_dns(".example.com") \ /// .permit_rfc822(".example.com") \ /// .permit_ip(b"\x0a\x00\x00\x00\xff\x00\x00\x00") \ /// .exclude_dns(".evil.com") \ /// .build() /// ```
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<PyNameConstraintsBuilder>
type ThreadChecker = SendablePyClass<PyNameConstraintsBuilder>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature for PyNameConstraintsBuilder
impl PyClassNewTextSignature for PyNameConstraintsBuilder
const TEXT_SIGNATURE: &'static str = "()"
Source§impl PyMethods<PyNameConstraintsBuilder> for PyClassImplCollector<PyNameConstraintsBuilder>
impl PyMethods<PyNameConstraintsBuilder> for PyClassImplCollector<PyNameConstraintsBuilder>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PyNameConstraintsBuilder
impl PyTypeInfo for PyNameConstraintsBuilder
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Auto Trait Implementations§
impl Freeze for PyNameConstraintsBuilder
impl RefUnwindSafe for PyNameConstraintsBuilder
impl Send for PyNameConstraintsBuilder
impl Sync for PyNameConstraintsBuilder
impl Unpin for PyNameConstraintsBuilder
impl UnsafeUnpin for PyNameConstraintsBuilder
impl UnwindSafe for PyNameConstraintsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.