Python cryptography.x509 模块,CertificateRevocationList() 实例源码

我们从Python开源项目中,提取了以下21个代码示例,用于说明如何使用cryptography.x509.CertificateRevocationList()

项目:2FAssassin    作者:maxwellkoh    | 项目源码 | 文件源码
def from_cryptography(cls, crypto_crl):
        """
        Construct based on a ``cryptography`` *crypto_crl*.

        :param crypto_crl: A ``cryptography`` certificate revocation list
        :type crypto_crl: ``cryptography.x509.CertificateRevocationList``

        :rtype: CRL

        .. versionadded:: 17.1.0
        """
        if not isinstance(crypto_crl, x509.CertificateRevocationList):
            raise TypeError("Must be a certificate revocation list")

        crl = cls()
        crl._crl = crypto_crl._x509_crl
        return crl
项目:2FAssassin    作者:maxwellkoh    | 项目源码 | 文件源码
def from_cryptography(cls, crypto_crl):
        """
        Construct based on a ``cryptography`` *crypto_crl*.

        :param crypto_crl: A ``cryptography`` certificate revocation list
        :type crypto_crl: ``cryptography.x509.CertificateRevocationList``

        :rtype: CRL

        .. versionadded:: 17.1.0
        """
        if not isinstance(crypto_crl, x509.CertificateRevocationList):
            raise TypeError("Must be a certificate revocation list")

        crl = cls()
        crl._crl = crypto_crl._x509_crl
        return crl
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
def __verify_x509_signature(self, c, key):
                """Verify the signature of a certificate or CRL 'c' against a
                provided public key 'key'."""

                verifier = key.verifier(
                    c.signature, padding.PKCS1v15(),
                    c.signature_hash_algorithm)

                if isinstance(c, x509.Certificate):
                        data = c.tbs_certificate_bytes
                elif isinstance(c, x509.CertificateRevocationList):
                        data = c.tbs_certlist_bytes
                else:
                        raise AssertionError("Invalid x509 object for "
                            "signature verification: {0}".format(type(c)))

                verifier.update(data)
                try:
                        verifier.verify()
                        return True
                except Exception:
                        return False
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:2FAssassin    作者:maxwellkoh    | 项目源码 | 文件源码
def test_convert_to_cryptography_key(self):
        crl = load_crl(FILETYPE_PEM, crlData)
        crypto_crl = crl.to_cryptography()
        assert isinstance(crypto_crl, x509.CertificateRevocationList)
项目:2FAssassin    作者:maxwellkoh    | 项目源码 | 文件源码
def to_cryptography(self):
        """
        Export as a ``cryptography`` CRL.

        :rtype: ``cryptography.x509.CertificateRevocationList``

        .. versionadded:: 17.1.0
        """
        from cryptography.hazmat.backends.openssl.x509 import (
            _CertificateRevocationList
        )
        backend = _get_backend()
        return _CertificateRevocationList(backend, self._crl)
项目:2FAssassin    作者:maxwellkoh    | 项目源码 | 文件源码
def to_cryptography(self):
        """
        Export as a ``cryptography`` CRL.

        :rtype: ``cryptography.x509.CertificateRevocationList``

        .. versionadded:: 17.1.0
        """
        from cryptography.hazmat.backends.openssl.x509 import (
            _CertificateRevocationList
        )
        backend = _get_backend()
        return _CertificateRevocationList(backend, self._crl)
项目:OneClickDTU    作者:satwikkansal    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:xxNet    作者:drzorm    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:xxNet    作者:drzorm    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:slack_scholar    作者:xLeitix    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:RemoteTree    作者:deNULL    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:quickstart-git2s3    作者:aws-quickstart    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:Docker-XX-Net    作者:kuanghy    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0
项目:PyQYT    作者:collinsctk    | 项目源码 | 文件源码
def __eq__(self, other):
        if not isinstance(other, x509.CertificateRevocationList):
            return NotImplemented

        res = self._backend._lib.X509_CRL_cmp(self._x509_crl, other._x509_crl)
        return res == 0