當前位置: 首頁>>代碼示例>>Python>>正文


Python ExtensionOID.BASIC_CONSTRAINTS屬性代碼示例

本文整理匯總了Python中cryptography.x509.oid.ExtensionOID.BASIC_CONSTRAINTS屬性的典型用法代碼示例。如果您正苦於以下問題:Python ExtensionOID.BASIC_CONSTRAINTS屬性的具體用法?Python ExtensionOID.BASIC_CONSTRAINTS怎麽用?Python ExtensionOID.BASIC_CONSTRAINTS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在cryptography.x509.oid.ExtensionOID的用法示例。


在下文中一共展示了ExtensionOID.BASIC_CONSTRAINTS屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: is_ca

# 需要導入模塊: from cryptography.x509.oid import ExtensionOID [as 別名]
# 或者: from cryptography.x509.oid.ExtensionOID import BASIC_CONSTRAINTS [as 別名]
def is_ca(certificate):
    # TODO: test self signed if no extensions found
    extensions = certificate.extensions
    try:
        return extensions.get_extension_for_oid(ExtensionOID.BASIC_CONSTRAINTS).value.ca
    except x509.ExtensionNotFound:
        try:
            return extensions.get_extension_for_oid(ExtensionOID.KEY_USAGE).value.key_cert_sign
        except x509.ExtensionNotFound:
            pass
    return False 
開發者ID:zentralopensource,項目名稱:zentral,代碼行數:13,代碼來源:utils.py

示例2: basic_constraints

# 需要導入模塊: from cryptography.x509.oid import ExtensionOID [as 別名]
# 或者: from cryptography.x509.oid.ExtensionOID import BASIC_CONSTRAINTS [as 別名]
def basic_constraints(self):
        ext = self.get_x509_extension(ExtensionOID.BASIC_CONSTRAINTS)
        if ext is not None:
            return BasicConstraints(ext) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:6,代碼來源:models.py

示例3: pathlen

# 需要導入模塊: from cryptography.x509.oid import ExtensionOID [as 別名]
# 或者: from cryptography.x509.oid.ExtensionOID import BASIC_CONSTRAINTS [as 別名]
def pathlen(self):
        """The ``pathlen`` attribute of the ``BasicConstraints`` extension (either an ``int`` or ``None``)."""

        try:
            ext = self.x509.extensions.get_extension_for_oid(ExtensionOID.BASIC_CONSTRAINTS)
        except x509.ExtensionNotFound:  # pragma: no cover - extension should always be present
            return None
        return ext.value.path_length 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:10,代碼來源:models.py


注:本文中的cryptography.x509.oid.ExtensionOID.BASIC_CONSTRAINTS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。