MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / dummy_crl

Function dummy_crl

mitmproxy/certs.py:407–428  ·  view source on GitHub ↗

Generates an empty CRL signed with the CA key privkey: CA private key cacert: CA certificate Returns a CRL DER encoded

(
    privkey: rsa.RSAPrivateKey,
    cacert: x509.Certificate,
)

Source from the content-addressed store, hash-verified

405
406
407def dummy_crl(
408 privkey: rsa.RSAPrivateKey,
409 cacert: x509.Certificate,
410) -> bytes:
411 """
412 Generates an empty CRL signed with the CA key
413
414 privkey: CA private key
415 cacert: CA certificate
416
417 Returns a CRL DER encoded
418 """
419 builder = x509.CertificateRevocationListBuilder()
420 builder = builder.issuer_name(cacert.issuer)
421
422 now = datetime.datetime.now()
423 builder = builder.last_update(now + CERT_VALIDITY_OFFSET)
424 builder = builder.next_update(now + CERT_VALIDITY_OFFSET + CRL_EXPIRY)
425
426 builder = builder.add_extension(x509.CRLNumber(1000), False) # meaningless number
427 crl = builder.sign(private_key=privkey, algorithm=hashes.SHA256())
428 return crl.public_bytes(serialization.Encoding.DER)
429
430
431@dataclass(frozen=True)

Callers 1

from_filesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…