autocsr package

Submodules

autocsr.cli module

autocsr.csr module

autocsr.extensions module

Wrappers to turn configs into x509 Extensions.

class autocsr.extensions.AccessDescription(access_method: cryptography.hazmat._oid.ObjectIdentifier, access_location: cryptography.x509.general_name.GeneralName)

Bases: cryptography.x509.extensions.AccessDescription

Wrapper for AccessDescription from a config file.

classmethod from_proto(description: csr_pb2.AccessDescription)

Create a AccessDescription from a protobuf.

Parameters

description (CsrExtension.AccessDescription) – A protobuf of a AccessDescription.

Returns

A cryptography representation of a AccessDescription.

Return type

cryptography.x509.extensions.AccessDescription

class autocsr.extensions.AuthorityInformationAccess(descriptions: Iterable[cryptography.x509.extensions.AccessDescription])

Bases: cryptography.x509.extensions.AuthorityInformationAccess

Wrapper for AuthorityInformationAccess Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a AuthorityInformationAccess Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a AuthorityInformationAccess Extension.

Return type

cryptography.x509.extensions.AuthorityInformationAccess

class autocsr.extensions.AuthorityKeyIdentifier(key_identifier: Optional[bytes], authority_cert_issuer: Optional[Iterable[cryptography.x509.general_name.GeneralName]], authority_cert_serial_number: Optional[int])

Bases: cryptography.x509.extensions.AuthorityKeyIdentifier

Wrapper for AuthorityKeyIdentifier Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a AuthorityKeyIdentifier Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a AuthorityKeyIdentifier Extension.

Return type

cryptography.x509.extensions.AuthorityKeyIdentifier

class autocsr.extensions.BasicConstraints(ca: bool, path_length: Optional[int])

Bases: cryptography.x509.extensions.BasicConstraints

Wrapper for BasicConstraints Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a BasicConstraints extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a BasicConstraints Extension.

Return type

cryptography.x509.extensions.BasicConstraints

class autocsr.extensions.CRLDistributionPoints(distribution_points: Iterable[cryptography.x509.extensions.DistributionPoint])

Bases: cryptography.x509.extensions.CRLDistributionPoints

Wrapper for CRLDistributionPoints Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a CRLDistributionPoints Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a CRLDistributionPoints Extension.

Return type

cryptography.x509.extensions.CRLDistributionPoints

class autocsr.extensions.CertificatePolicies(policies: Iterable[cryptography.x509.extensions.PolicyInformation])

Bases: cryptography.x509.extensions.CertificatePolicies

Wrapper for CertificatePolicies Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a CertificatePolicies Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a CertificatePolicies Extension.

Return type

cryptography.x509.extensions.CertificatePolicies

class autocsr.extensions.DNSName(value: str)

Bases: cryptography.x509.general_name.DNSName

Wrapper for DNSName general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a DNSName from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a DNSName.

Returns

A cryptography representation of a DNSName.

Return type

cryptography.x509.general_name.DNSName

class autocsr.extensions.DirectoryName(value: cryptography.x509.name.Name)

Bases: cryptography.x509.general_name.DirectoryName

Wrapper for DirectoryName general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a DirectoryName from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a DirectoryName.

Returns

A cryptography representation of a DirectoryName.

Return type

cryptography.x509.general_name.DirectoryName

class autocsr.extensions.DistributionPoint(full_name: Optional[Iterable[cryptography.x509.general_name.GeneralName]], relative_name: Optional[cryptography.x509.name.RelativeDistinguishedName], reasons: Optional[FrozenSet[cryptography.x509.extensions.ReasonFlags]], crl_issuer: Optional[Iterable[cryptography.x509.general_name.GeneralName]])

Bases: cryptography.x509.extensions.DistributionPoint

Wrapper for DistributionPoint from config file.

classmethod from_proto(dist: csr_pb2.DistributionPoint)

Create a DistributionPoint from a protobuf.

Parameters

dist (CsrExtension.DistributionPoint) – A protobuf of a DistributionPoint.

Returns

A cryptography representation of a DistributionPoint.

Return type

cryptography.x509.extensions.DistributionPoint

class autocsr.extensions.ExtendedKeyUsage(usages: Iterable[cryptography.hazmat._oid.ObjectIdentifier])

Bases: cryptography.x509.extensions.ExtendedKeyUsage

Wrapper for ExtendedKeyUsage extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a ExtendedKeyUsage Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a ExtendedKeyUsage Extension.

Return type

cryptography.x509.extensions.ExtendedKeyUsage

class autocsr.extensions.Extension

Bases: object

A factory for creating x509 Extensions from config.

extension_list = {'authority_information_access': <class 'autocsr.extensions.AuthorityInformationAccess'>, 'authority_key_identifier': <class 'autocsr.extensions.AuthorityKeyIdentifier'>, 'basic_constraints': <class 'autocsr.extensions.BasicConstraints'>, 'certificate_policies': <class 'autocsr.extensions.CertificatePolicies'>, 'crl_distribution_points': <class 'autocsr.extensions.CRLDistributionPoints'>, 'extended_key_usage': <class 'autocsr.extensions.ExtendedKeyUsage'>, 'extension_type': <class 'autocsr.extensions.ExtensionType'>, 'freshest_crl': <class 'autocsr.extensions.FreshestCRL'>, 'inhibit_any_policy': <class 'autocsr.extensions.InhibitAnyPolicy'>, 'issuer_alternative_name': <class 'autocsr.extensions.IssuerAlternativeName'>, 'key_usage': <class 'autocsr.extensions.KeyUsage'>, 'name_constraints': <class 'autocsr.extensions.NameConstraints'>, 'policy_constraints': <class 'autocsr.extensions.PolicyConstraints'>, 'subject_alternative_name': <class 'autocsr.extensions.SubjectAlternativeName'>, 'subject_information_access': <class 'autocsr.extensions.SubjectInformationAccess'>, 'subject_key_identifier': <class 'autocsr.extensions.SubjectKeyIdentifier'>, 'tls_feature': <class 'autocsr.extensions.TLSFeature'>}
static from_proto(extension: csr_pb2.Extension)cryptography.x509.extensions.ExtensionType

Create a cryptography Extension from a protobuf representation.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a CSR Extension.

Return type

cryptography.x509.extensions.ExtensionType

class autocsr.extensions.ExtensionType

Bases: object

Factory for returning a parameter-less extension from a protobuf.

static from_proto(extension: csr_pb2.Extension)cryptography.x509.extensions.ExtensionType

Return an extension instance based on enum extension type.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a CSR Extension.

Return type

cryptography.x509.extensions.ExtensionType

class autocsr.extensions.FreshestCRL(distribution_points: Iterable[cryptography.x509.extensions.DistributionPoint])

Bases: cryptography.x509.extensions.FreshestCRL

Wrapper for FreshestCRL Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a FreshestCRL Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a FreshestCRL Extension.

Return type

cryptography.x509.extensions.FreshestCRL

class autocsr.extensions.GeneralName

Bases: object

Factory for creating General Names from a config.

static from_proto(name: csr_pb2.GeneralName)cryptography.x509.general_name.GeneralName

Create a GeneralName instance from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a GeneralName.

Returns

A cryptography representation of a GeneralName.

Return type

cryptography.x509.general_name.GeneralName

name_types = {'directory_name': <class 'autocsr.extensions.DirectoryName'>, 'dns_name': <class 'autocsr.extensions.DNSName'>, 'ip_address': <class 'autocsr.extensions.IPAddress'>, 'other_name': <class 'autocsr.extensions.OtherName'>, 'registered_id': <class 'autocsr.extensions.RegisteredID'>, 'rfc_822_name': <class 'autocsr.extensions.RFC822Name'>, 'uniform_resource_identifier': <class 'autocsr.extensions.UniformResourceIdentifier'>}
class autocsr.extensions.IPAddress(value: Union[ipaddress.IPv4Address, ipaddress.IPv6Address, ipaddress.IPv4Network, ipaddress.IPv6Network])

Bases: cryptography.x509.general_name.IPAddress

Wrapper for an IPAddress general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a IPAddress from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a IPAddress.

Returns

A cryptography representation of a IPAddress.

Return type

cryptography.x509.general_name.IPAddress

class autocsr.extensions.InhibitAnyPolicy(skip_certs: int)

Bases: cryptography.x509.extensions.InhibitAnyPolicy

Wrapper for InhibitAnyPolicy Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a InhibitAnyPolicy Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a InhibitAnyPolicy Extension.

Return type

cryptography.x509.extensions.InhibitAnyPolicy

class autocsr.extensions.IssuerAlternativeName(general_names: Iterable[cryptography.x509.general_name.GeneralName])

Bases: cryptography.x509.extensions.IssuerAlternativeName

Wrapper for IssuerAlternativeName Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a IssuerAlternativeName Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a IssuerAlternativeName Extension.

Return type

cryptography.x509.extensions.IssuerAlternativeName

class autocsr.extensions.KeyUsage(digital_signature: bool, content_commitment: bool, key_encipherment: bool, data_encipherment: bool, key_agreement: bool, key_cert_sign: bool, crl_sign: bool, encipher_only: bool, decipher_only: bool)

Bases: cryptography.x509.extensions.KeyUsage

Wrapper for KeyUsage Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a KeyUsage Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a KeyUsage Extension.

Return type

cryptography.x509.extensions.KeyUsage

class autocsr.extensions.Name(attributes)

Bases: cryptography.x509.name.Name

Wrapper for Name from config file.

classmethod from_proto(name: csr_pb2.Name)

Create a Name from a config file.

Parameters

name (CsrExtension.Name) – A protobuf representation of a Name.

Returns

A cryptography representation of a Name.

Return type

cryptography.x509.name.Name

class autocsr.extensions.NameAttribute(oid: cryptography.hazmat._oid.ObjectIdentifier, value: str, _type=<object object>)

Bases: cryptography.x509.name.NameAttribute

Wrapper for NameAttribute from config file.

classmethod from_proto(attribute: csr_pb2.NameAttribute)

Create a NameAttribute from a config file.

Parameters

attribute (CsrExtension.NameAttribute) – A protobuf representation of a NameAttribute.

Returns

A cryptography representation of a NameAttribute.

Return type

cryptography.x509.name.NameAttribute

class autocsr.extensions.NameConstraints(permitted_subtrees: Optional[Iterable[cryptography.x509.general_name.GeneralName]], excluded_subtrees: Optional[Iterable[cryptography.x509.general_name.GeneralName]])

Bases: cryptography.x509.extensions.NameConstraints

Wrapper for a NameConstraints extension from a config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a NameConstraints Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a NameConstraints Extension.

Return type

cryptography.x509.extensions.NameConstraints

class autocsr.extensions.NoticeReference(organization: Optional[str], notice_numbers: Iterable[int])

Bases: cryptography.x509.extensions.NoticeReference

Wrapper for NoticeReference from config file.

classmethod from_proto(notice: csr_pb2.NoticeReference)

Create a NoticeReference from a protobuf.

Parameters

notice (CsrExtension.NoticeReference) – A protobuf representation of a NoticeReference.

Returns

A cryptography representation of a NoticeReference.

Return type

cryptography.x509.extensions.NoticeReference

class autocsr.extensions.OtherName(type_id: cryptography.hazmat._oid.ObjectIdentifier, value: bytes)

Bases: cryptography.x509.general_name.OtherName

Wrapper for an OtherName general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a OtherName from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a OtherName.

Returns

A cryptography representation of a OtherName.

Return type

cryptography.x509.general_name.OtherName

class autocsr.extensions.PolicyConstraints(require_explicit_policy: Optional[int], inhibit_policy_mapping: Optional[int])

Bases: cryptography.x509.extensions.PolicyConstraints

Wrapper for PolicyConstraints Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a PolicyConstraints Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a PolicyConstraints Extension.

Return type

cryptography.x509.extensions.PolicyConstraints

class autocsr.extensions.PolicyInformation(policy_identifier: cryptography.hazmat._oid.ObjectIdentifier, policy_qualifiers: Optional[Iterable[Union[str, cryptography.x509.extensions.UserNotice]]])

Bases: cryptography.x509.extensions.PolicyInformation

Wrapper for PolicyInformation from config file.

classmethod from_proto(policies: Iterable[csr_pb2.PolicyInformation])

Create a list of PolicyInformation from a protobuf.

Parameters

policies (Iterable[CsrExtension.PolicyInformation]) – A protobuf of PolicyInformations

Returns

A cryptography representation of PolicyInformations.

Return type

Iterable[cryptography.x509.extensions.PolicyInformation]

class autocsr.extensions.RFC822Name(value: str)

Bases: cryptography.x509.general_name.RFC822Name

Wrapper for RFC822Name general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a RFC822Name from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a RFC822Name.

Returns

A cryptography representation of a RFC822Name.

Return type

cryptography.x509.general_name.RFC822Name

class autocsr.extensions.ReasonFlags

Bases: object

Map int enum ReasonFlags to exceptions.ReasonFlag enums.

ExtFlag

alias of cryptography.x509.extensions.ReasonFlags

ProtoFlag = <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object>
flags = {0: <ReasonFlags.unspecified: 'unspecified'>, 1: <ReasonFlags.key_compromise: 'keyCompromise'>, 2: <ReasonFlags.ca_compromise: 'cACompromise'>, 3: <ReasonFlags.affiliation_changed: 'affiliationChanged'>, 4: <ReasonFlags.superseded: 'superseded'>, 5: <ReasonFlags.cessation_of_operation: 'cessationOfOperation'>, 7: <ReasonFlags.privilege_withdrawn: 'privilegeWithdrawn'>, 8: <ReasonFlags.aa_compromise: 'aACompromise'>, 9: <ReasonFlags.remove_from_crl: 'removeFromCRL'>}
static from_proto(reason: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7fcf9d1235d0>)cryptography.x509.extensions.ReasonFlags

Convert a protobuf version ReasonFlag into the cryptography version.

Parameters

reason (ProtoFlag) – A protobuf representation of a ReasonFlag.

Returns

A cryptography representation of a ReasonFlag.

Return type

cryptography.x509.extensions.ReasonFlags

class autocsr.extensions.RegisteredID(value: cryptography.hazmat._oid.ObjectIdentifier)

Bases: cryptography.x509.general_name.RegisteredID

Wrapper for RegisteredID general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a RegisteredID from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf representation of a RegisteredID.

Returns

A cryptography representation of a RegisteredID.

Return type

cryptography.x509.general_name.RegisteredID

class autocsr.extensions.RelativeDistinguishedName(attributes: Iterable[cryptography.x509.name.NameAttribute])

Bases: cryptography.x509.name.RelativeDistinguishedName

Wrapper for RelativeDistinguishedName from config file.

classmethod from_proto(name: csr_pb2.Name)

Create a RelativeDistinguishedName from a config file.

Parameters

name (CsrExtension.Name) – A protobuf representation of a RelativeDistinguishedName.

Returns

A cryptography representation of a RelativeDistinguishedName.

Return type

cryptography.x509.name.RelativeDistinguishedName

class autocsr.extensions.SubjectAlternativeName(general_names: Iterable[cryptography.x509.general_name.GeneralName])

Bases: cryptography.x509.extensions.SubjectAlternativeName

Wrapper for SubjectAlternativeName Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a SubjectAlternativeName Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a SubjectAlternativeName Extension.

Return type

cryptography.x509.extensions.SubjectAlternativeName

class autocsr.extensions.SubjectInformationAccess(descriptions: Iterable[cryptography.x509.extensions.AccessDescription])

Bases: cryptography.x509.extensions.SubjectInformationAccess

Wrapper for SubjectInformationAccess Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a SubjectInformationAccess Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a SubjectInformationAccess Extension.

Return type

cryptography.x509.extensions.SubjectInformationAccess

class autocsr.extensions.SubjectKeyIdentifier(digest: bytes)

Bases: cryptography.x509.extensions.SubjectKeyIdentifier

Wrapper for SubjectKeyIdentifier Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a SubjectKeyIdentifier extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a SubjectKeyIdentifier Extension.

Return type

cryptography.x509.extensions.SubjectKeyIdentifier

class autocsr.extensions.TLSFeature(features: Iterable[cryptography.x509.extensions.TLSFeatureType])

Bases: cryptography.x509.extensions.TLSFeature

Wrapper for TLSFeature Extension from config file.

classmethod from_proto(extension: csr_pb2.Extension)

Create a TLSFeature Extension from a protobuf.

Parameters

extension (CsrExtension) – A protobuf representation of a CSR Extension.

Returns

A cryptography representation of a TLSFeature Extension.

Return type

cryptography.x509.extensions.TLSFeature

class autocsr.extensions.UniformResourceIdentifier(value: str)

Bases: cryptography.x509.general_name.UniformResourceIdentifier

Wrapper for UniformResourceIdentifier general name from config file.

classmethod from_proto(name: csr_pb2.GeneralName)

Create a UniformResourceIdentifier from a protobuf.

Parameters

name (CsrExtension.GeneralName) – A protobuf of a UniformResourceIdentifier.

Returns

A cryptography representation of a UniformResourceIdentifier.

Return type

cryptography.x509.general_name.UniformResourceIdentifier

class autocsr.extensions.UserNotice(notice_reference: Optional[cryptography.x509.extensions.NoticeReference], explicit_text: Optional[str])

Bases: cryptography.x509.extensions.UserNotice

Wrapper for UserNotice from config file.

classmethod from_proto(notices: Iterable[csr_pb2.UserNotice])Iterable[cryptography.x509.extensions.UserNotice]

Create a list of UserNotice form a protobuf.

Parameters

notices (Iterable[CsrExtension.UserNotice]) – A protobuf representation of UserNotices.

Returns

A cryptography representation of UserNotices.

Return type

Iterable[cryptography.x509.extensions.UserNotice]

autocsr.hsm module

autocsr.oid module

Create wrapped Object Identifiers.

class autocsr.oid.ObjectIdentifier(dotted_string: str)

Bases: cryptography.hazmat._oid.ObjectIdentifier

A wrapped Object Identifier with custom factory methods.

classmethod from_string(oid: str)

Create an ObjectIdentifier from a dotted string or associated name.

Parameters

oid (str) – String representation of an Object Identifier.

Returns

The x509 representation of an Object Identifier.

Return type

cryptography.x509.ObjectIdentifier

autocsr.utils module

Module contents