💾 Archived View for tris.fyi › pydoc › cryptography.x509.base captured on 2022-06-11 at 21:46:07. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-04-28)

➡️ Next capture (2022-07-16)

-=-=-=-=-=-=-

Back to module index

Go to module by name

cryptography.x509

cryptography

cryptography.x509.base

This module has no docstring.

Classes

AttributeNotFound

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

Certificate

fingerprint(self, algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm) -> bytes


          Returns bytes using digest passed.
        
public_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding) -> bytes


          Serializes the certificate to PEM or DER format.
        
public_key(self) -> Union[cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey, cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PublicKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PublicKey]


          Returns the public key
        
extensions = <abc.abstractproperty object at 0x7ff35fe2a460>

          Returns an Extensions object.
        
issuer = <abc.abstractproperty object at 0x7ff35ff66460>

          Returns the issuer name object.
        
not_valid_after = <abc.abstractproperty object at 0x7ff35ff66160>

          Not after time (represented as UTC datetime)
        
not_valid_before = <abc.abstractproperty object at 0x7ff35fef92e0>

          Not before time (represented as UTC datetime)
        
serial_number = <abc.abstractproperty object at 0x7ff35fef9220>

          Returns certificate serial number
        
signature = <abc.abstractproperty object at 0x7ff35fe2a580>

          Returns the signature bytes.
        
signature_algorithm_oid = <abc.abstractproperty object at 0x7ff35fe2a400>

          Returns the ObjectIdentifier of the signature algorithm.
        
signature_hash_algorithm = <abc.abstractproperty object at 0x7ff35ff66760>

          Returns a HashAlgorithm corresponding to the type of the digest signed
          in the certificate.
        
subject = <abc.abstractproperty object at 0x7ff35ff664c0>

          Returns the subject name object.
        
tbs_certificate_bytes = <abc.abstractproperty object at 0x7ff35fe2a820>

          Returns the tbsCertificate payload bytes as defined in RFC 5280.
        
version = <abc.abstractproperty object at 0x7ff35fef9280>

          Returns the certificate version
        

CertificateBuilder

add_extension(self, extval: cryptography.x509.extensions.ExtensionType, critical: bool)


          Adds an X.509 extension to the certificate.
        
issuer_name(self, name: cryptography.x509.name.Name)


          Sets the CA's distinguished name.
        
not_valid_after(self, time: datetime.datetime)


          Sets the certificate expiration time.
        
not_valid_before(self, time: datetime.datetime)


          Sets the certificate activation time.
        
public_key(self, key: Union[cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey, cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PublicKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PublicKey])


          Sets the requestor's public key (as found in the signing request).
        
serial_number(self, number: int)


          Sets the certificate serial number.
        
sign(self, private_key: Union[cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PrivateKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey, cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey], algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm, backend=None) -> cryptography.x509.base.Certificate


          Signs the certificate using the CA's private key.
        
subject_name(self, name: cryptography.x509.name.Name)


          Sets the requestor's distinguished name.
        

CertificateRevocationList

fingerprint(self, algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm) -> bytes


          Returns bytes using digest passed.
        
get_revoked_certificate_by_serial_number(self, serial_number: int) -> Optional[cryptography.x509.base.RevokedCertificate]


          Returns an instance of RevokedCertificate or None if the serial_number
          is not in the CRL.
        
is_signature_valid(self, public_key: Union[cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey, cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PublicKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PublicKey]) -> bool


          Verifies signature of revocation list against given public key.
        
public_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding) -> bytes


          Serializes the CRL to PEM or DER format.
        
extensions = <abc.abstractproperty object at 0x7ff35fe2ab80>

          Returns an Extensions object containing a list of CRL extensions.
        
issuer = <abc.abstractproperty object at 0x7ff35fe2aa60>

          Returns the X509Name with the issuer of this CRL.
        
last_update = <abc.abstractproperty object at 0x7ff35fe2ab20>

          Returns the date of last update for this CRL.
        
next_update = <abc.abstractproperty object at 0x7ff35fe2aac0>

          Returns the date of next update for this CRL.
        
signature = <abc.abstractproperty object at 0x7ff35fe2abe0>

          Returns the signature bytes.
        
signature_algorithm_oid = <abc.abstractproperty object at 0x7ff35fe2aa00>

          Returns the ObjectIdentifier of the signature algorithm.
        
signature_hash_algorithm = <abc.abstractproperty object at 0x7ff35fe2a9a0>

          Returns a HashAlgorithm corresponding to the type of the digest signed
          in the certificate.
        
tbs_certlist_bytes = <abc.abstractproperty object at 0x7ff35fe2ac40>

          Returns the tbsCertList payload bytes as defined in RFC 5280.
        

CertificateRevocationListBuilder

add_extension(self, extval: cryptography.x509.extensions.ExtensionType, critical: bool)


          Adds an X.509 extension to the certificate revocation list.
        
add_revoked_certificate(self, revoked_certificate: cryptography.x509.base.RevokedCertificate)


          Adds a revoked certificate to the CRL.
        
issuer_name(self, issuer_name: cryptography.x509.name.Name)
last_update(self, last_update: datetime.datetime)
next_update(self, next_update: datetime.datetime)
sign(self, private_key: Union[cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PrivateKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey, cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey], algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm, backend=None) -> cryptography.x509.base.CertificateRevocationList

CertificateSigningRequest

get_attribute_for_oid(self, oid: cryptography.hazmat._oid.ObjectIdentifier) -> bytes


          Get the attribute value for a given OID.
        
public_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding) -> bytes


          Encodes the request to PEM or DER format.
        
public_key(self) -> Union[cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey, cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PublicKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PublicKey]


          Returns the public key
        
extensions = <abc.abstractproperty object at 0x7ff35fe2adc0>

          Returns the extensions in the signing request.
        
is_signature_valid = <abc.abstractproperty object at 0x7ff35fe2aee0>

          Verifies signature of signing request.
        
signature = <abc.abstractproperty object at 0x7ff35fe2ae20>

          Returns the signature bytes.
        
signature_algorithm_oid = <abc.abstractproperty object at 0x7ff35fe2ad60>

          Returns the ObjectIdentifier of the signature algorithm.
        
signature_hash_algorithm = <abc.abstractproperty object at 0x7ff35fe2ad00>

          Returns a HashAlgorithm corresponding to the type of the digest signed
          in the certificate.
        
subject = <abc.abstractproperty object at 0x7ff35fe2aca0>

          Returns the subject name object.
        
tbs_certrequest_bytes = <abc.abstractproperty object at 0x7ff35fe2ae80>

          Returns the PKCS#10 CertificationRequestInfo bytes as defined in RFC
          2986.
        

CertificateSigningRequestBuilder

add_attribute(self, oid: cryptography.hazmat._oid.ObjectIdentifier, value: bytes)


          Adds an X.509 attribute with an OID and associated value.
        
add_extension(self, extval: cryptography.x509.extensions.ExtensionType, critical: bool)


          Adds an X.509 extension to the certificate request.
        
sign(self, private_key: Union[cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey, cryptography.hazmat.primitives.asymmetric.ed448.Ed448PrivateKey, cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey, cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey, cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey], algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm, backend=None) -> cryptography.x509.base.CertificateSigningRequest


          Signs the request using the requestor's private key.
        
subject_name(self, name: cryptography.x509.name.Name)


          Sets the certificate requestor's distinguished name.
        

Enum


    Generic enumeration.

    Derive from this class to define new enumerations.
    

Extension

critical = <property object at 0x7ff36028c900>
oid = <property object at 0x7ff36028c8b0>
value = <property object at 0x7ff36028c950>

ExtensionType

oid = <abc.abstractproperty object at 0x7ff35ff1dca0>

          Returns the oid associated with the given extension type.
        

Extensions

get_extension_for_class(self, extclass) -> 'Extension'
get_extension_for_oid(self, oid: cryptography.hazmat._oid.ObjectIdentifier) -> 'Extension'

InvalidVersion

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

Name

get_attributes_for_oid(self, oid) -> List[cryptography.x509.name.NameAttribute]
public_bytes(self, backend=None) -> bytes
rfc4514_string(self) -> str


          Format as RFC4514 Distinguished Name string.
          For example 'CN=foobar.com,O=Foo Corp,C=US'

          An X.509 name is a two-level structure: a list of sets of attributes.
          Each list element is separated by ',' and within each list element, set
          elements are separated by '+'. The latter is almost never used in
          real world certificates. According to RFC4514 section 2.1 the
          RDNSequence must be reversed when converting to string representation.
        
rdns = <property object at 0x7ff35fe327c0>

ObjectIdentifier

dotted_string = <property object at 0x7ff35ff7aae0>

RevokedCertificate

extensions = <abc.abstractproperty object at 0x7ff35fe2a940>

          Returns an Extensions object containing a list of Revoked extensions.
        
revocation_date = <abc.abstractproperty object at 0x7ff35fe2a8e0>

          Returns the date of when this certificate was revoked.
        
serial_number = <abc.abstractproperty object at 0x7ff35fe2a880>

          Returns the serial number of the revoked certificate.
        

RevokedCertificateBuilder

add_extension(self, extval: cryptography.x509.extensions.ExtensionType, critical: bool)
build(self, backend=None) -> cryptography.x509.base.RevokedCertificate
revocation_date(self, time: datetime.datetime)
serial_number(self, number: int)

Version

An enumeration.
name = <types.DynamicClassAttribute object at 0x7ff36084fb80>
  The name of the Enum member.
v1 = <Version.v1: 0>
v3 = <Version.v3: 2>
value = <types.DynamicClassAttribute object at 0x7ff36084fbb0>
  The value of the Enum member.

Functions

load_der_x509_certificate

load_der_x509_certificate(data: bytes, backend=None) -> cryptography.x509.base.Certificate

load_der_x509_crl

load_der_x509_crl(data: bytes, backend=None) -> cryptography.x509.base.CertificateRevocationList

load_der_x509_csr

load_der_x509_csr(data: bytes, backend=None) -> cryptography.x509.base.CertificateSigningRequest

load_pem_x509_certificate

load_pem_x509_certificate(data: bytes, backend=None) -> cryptography.x509.base.Certificate

load_pem_x509_crl

load_pem_x509_crl(data: bytes, backend=None) -> cryptography.x509.base.CertificateRevocationList

load_pem_x509_csr

load_pem_x509_csr(data: bytes, backend=None) -> cryptography.x509.base.CertificateSigningRequest

random_serial_number

random_serial_number() -> int

Modules

abc

datetime

dsa

ec

ed25519

ed448

hashes

os

rsa

serialization

typing