💾 Archived View for tris.fyi › pydoc › cryptography.x509.base captured on 2022-01-08 at 13:57:43. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2022-03-01)

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

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 0x7f056751a4c0>

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

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

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

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

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

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

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

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

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

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

          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 0x7f056751abe0>

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

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

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

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

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

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

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

          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 0x7f056751ae20>

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

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

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

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

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

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

          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 0x7f056797c860>
oid = <property object at 0x7f056797c810>
value = <property object at 0x7f056797c8b0>

ExtensionType

oid = <abc.abstractproperty object at 0x7f056760cd00>

          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 0x7f0567522770>

ObjectIdentifier

dotted_string = <property object at 0x7f056766aae0>

RevokedCertificate

extensions = <abc.abstractproperty object at 0x7f056751a9a0>

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

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

          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 0x7f0567f3eb80>
  The name of the Enum member.
v1 = <Version.v1: 0>
v3 = <Version.v3: 2>
value = <types.DynamicClassAttribute object at 0x7f0567f3ebb0>
  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