我们从Python开源项目中,提取了以下21个代码示例,用于说明如何使用cryptography.x509.CertificateRevocationList()。
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
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
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
def test_convert_to_cryptography_key(self): crl = load_crl(FILETYPE_PEM, crlData) crypto_crl = crl.to_cryptography() assert isinstance(crypto_crl, x509.CertificateRevocationList)
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)