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


Python x509.SubjectKeyIdentifier方法代碼示例

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


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

示例1: _decode_subject_key_identifier

# 需要導入模塊: from cryptography import x509 [as 別名]
# 或者: from cryptography.x509 import SubjectKeyIdentifier [as 別名]
def _decode_subject_key_identifier(backend, asn1_string):
    asn1_string = backend._ffi.cast("ASN1_OCTET_STRING *", asn1_string)
    asn1_string = backend._ffi.gc(
        asn1_string, backend._lib.ASN1_OCTET_STRING_free
    )
    return x509.SubjectKeyIdentifier(
        backend._ffi.buffer(asn1_string.data, asn1_string.length)[:]
    ) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:10,代碼來源:x509.py

示例2: subject_key_identifier

# 需要導入模塊: from cryptography import x509 [as 別名]
# 或者: from cryptography.x509 import SubjectKeyIdentifier [as 別名]
def subject_key_identifier(self):
        """The :py:class:`~django_ca.extensions.SubjectKeyIdentifier` extension, or ``None`` if it doesn't
        exist."""
        ext = self.get_x509_extension(ExtensionOID.SUBJECT_KEY_IDENTIFIER)
        if ext is not None:
            return SubjectKeyIdentifier(ext) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:8,代碼來源:models.py

示例3: get_authority_key_identifier

# 需要導入模塊: from cryptography import x509 [as 別名]
# 或者: from cryptography.x509 import SubjectKeyIdentifier [as 別名]
def get_authority_key_identifier(self):
        """Return the AuthorityKeyIdentifier extension used in certificates signed by this CA."""

        try:
            ski = self.x509.extensions.get_extension_for_class(x509.SubjectKeyIdentifier)
        except x509.ExtensionNotFound:
            return x509.AuthorityKeyIdentifier.from_issuer_public_key(self.x509.public_key())
        else:
            return x509.AuthorityKeyIdentifier.from_issuer_subject_key_identifier(ski.value) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:11,代碼來源:models.py

示例4: from_other

# 需要導入模塊: from cryptography import x509 [as 別名]
# 或者: from cryptography.x509 import SubjectKeyIdentifier [as 別名]
def from_other(self, value):
        if isinstance(value, SubjectKeyIdentifier):
            self.critical = self.default_critical
            self.from_subject_key_identifier(value)
            self._test_value()
        else:
            super().from_other(value) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:9,代碼來源:extensions.py

示例5: extension_type

# 需要導入模塊: from cryptography import x509 [as 別名]
# 或者: from cryptography.x509 import SubjectKeyIdentifier [as 別名]
def extension_type(self):
        return x509.SubjectKeyIdentifier(digest=self.value) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:4,代碼來源:extensions.py

示例6: extensions

# 需要導入模塊: from cryptography import x509 [as 別名]
# 或者: from cryptography.x509 import SubjectKeyIdentifier [as 別名]
def extensions(self):
        # setup default values
        return_extensions = {"sub_alt_names": {"names": []}}

        try:
            for extension in self.parsed_cert.extensions:
                value = extension.value
                if isinstance(value, x509.BasicConstraints):
                    return_extensions["basic_constraints"] = value

                elif isinstance(value, x509.SubjectAlternativeName):
                    return_extensions["sub_alt_names"]["names"] = value

                elif isinstance(value, x509.ExtendedKeyUsage):
                    return_extensions["extended_key_usage"] = value

                elif isinstance(value, x509.KeyUsage):
                    return_extensions["key_usage"] = value

                elif isinstance(value, x509.SubjectKeyIdentifier):
                    return_extensions["subject_key_identifier"] = {"include_ski": True}

                elif isinstance(value, x509.AuthorityInformationAccess):
                    return_extensions["certificate_info_access"] = {"include_aia": True}

                elif isinstance(value, x509.AuthorityKeyIdentifier):
                    aki = {"use_key_identifier": False, "use_authority_cert": False}

                    if value.key_identifier:
                        aki["use_key_identifier"] = True

                    if value.authority_cert_issuer:
                        aki["use_authority_cert"] = True

                    return_extensions["authority_key_identifier"] = aki

                elif isinstance(value, x509.CRLDistributionPoints):
                    return_extensions["crl_distribution_points"] = {
                        "include_crl_dp": value
                    }

                # TODO: Not supporting custom OIDs yet. https://github.com/Netflix/lemur/issues/665
                else:
                    current_app.logger.warning(
                        "Custom OIDs not yet supported for clone operation."
                    )
        except InvalidCodepoint as e:
            sentry.captureException()
            current_app.logger.warning(
                "Unable to parse extensions due to underscore in dns name"
            )
        except ValueError as e:
            sentry.captureException()
            current_app.logger.warning("Unable to parse")
            current_app.logger.exception(e)

        return return_extensions 
開發者ID:Netflix,項目名稱:lemur,代碼行數:59,代碼來源:models.py


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