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.AccessDescriptionWrapper 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
-
classmethod
-
class
autocsr.extensions.AuthorityInformationAccess(descriptions: Iterable[cryptography.x509.extensions.AccessDescription])¶ Bases:
cryptography.x509.extensions.AuthorityInformationAccessWrapper 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
-
classmethod
-
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.AuthorityKeyIdentifierWrapper 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
-
classmethod
-
class
autocsr.extensions.BasicConstraints(ca: bool, path_length: Optional[int])¶ Bases:
cryptography.x509.extensions.BasicConstraintsWrapper 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
-
classmethod
-
class
autocsr.extensions.CRLDistributionPoints(distribution_points: Iterable[cryptography.x509.extensions.DistributionPoint])¶ Bases:
cryptography.x509.extensions.CRLDistributionPointsWrapper 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
-
classmethod
-
class
autocsr.extensions.CertificatePolicies(policies: Iterable[cryptography.x509.extensions.PolicyInformation])¶ Bases:
cryptography.x509.extensions.CertificatePoliciesWrapper 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
-
classmethod
-
class
autocsr.extensions.DNSName(value: str)¶ Bases:
cryptography.x509.general_name.DNSNameWrapper 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
-
classmethod
-
class
autocsr.extensions.DirectoryName(value: cryptography.x509.name.Name)¶ Bases:
cryptography.x509.general_name.DirectoryNameWrapper 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
-
classmethod
-
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.DistributionPointWrapper 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
-
classmethod
-
class
autocsr.extensions.ExtendedKeyUsage(usages: Iterable[cryptography.hazmat._oid.ObjectIdentifier])¶ Bases:
cryptography.x509.extensions.ExtendedKeyUsageWrapper 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
-
classmethod
-
class
autocsr.extensions.Extension¶ Bases:
objectA 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:
objectFactory 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
-
static
-
class
autocsr.extensions.FreshestCRL(distribution_points: Iterable[cryptography.x509.extensions.DistributionPoint])¶ Bases:
cryptography.x509.extensions.FreshestCRLWrapper 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
-
classmethod
-
class
autocsr.extensions.GeneralName¶ Bases:
objectFactory 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'>}¶
-
static
-
class
autocsr.extensions.IPAddress(value: Union[ipaddress.IPv4Address, ipaddress.IPv6Address, ipaddress.IPv4Network, ipaddress.IPv6Network])¶ Bases:
cryptography.x509.general_name.IPAddressWrapper 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
-
classmethod
-
class
autocsr.extensions.InhibitAnyPolicy(skip_certs: int)¶ Bases:
cryptography.x509.extensions.InhibitAnyPolicyWrapper 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
-
classmethod
-
class
autocsr.extensions.IssuerAlternativeName(general_names: Iterable[cryptography.x509.general_name.GeneralName])¶ Bases:
cryptography.x509.extensions.IssuerAlternativeNameWrapper 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
-
classmethod
-
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.KeyUsageWrapper 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
-
classmethod
-
class
autocsr.extensions.Name(attributes)¶ Bases:
cryptography.x509.name.NameWrapper 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
-
classmethod
-
class
autocsr.extensions.NameAttribute(oid: cryptography.hazmat._oid.ObjectIdentifier, value: str, _type=<object object>)¶ Bases:
cryptography.x509.name.NameAttributeWrapper 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
-
classmethod
-
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.NameConstraintsWrapper 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
-
classmethod
-
class
autocsr.extensions.NoticeReference(organization: Optional[str], notice_numbers: Iterable[int])¶ Bases:
cryptography.x509.extensions.NoticeReferenceWrapper 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
-
classmethod
-
class
autocsr.extensions.OtherName(type_id: cryptography.hazmat._oid.ObjectIdentifier, value: bytes)¶ Bases:
cryptography.x509.general_name.OtherNameWrapper 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
-
classmethod
-
class
autocsr.extensions.PolicyConstraints(require_explicit_policy: Optional[int], inhibit_policy_mapping: Optional[int])¶ Bases:
cryptography.x509.extensions.PolicyConstraintsWrapper 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
-
classmethod
-
class
autocsr.extensions.PolicyInformation(policy_identifier: cryptography.hazmat._oid.ObjectIdentifier, policy_qualifiers: Optional[Iterable[Union[str, cryptography.x509.extensions.UserNotice]]])¶ Bases:
cryptography.x509.extensions.PolicyInformationWrapper 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]
-
classmethod
-
class
autocsr.extensions.RFC822Name(value: str)¶ Bases:
cryptography.x509.general_name.RFC822NameWrapper 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
-
classmethod
-
class
autocsr.extensions.ReasonFlags¶ Bases:
objectMap 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.RegisteredIDWrapper 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
-
classmethod
-
class
autocsr.extensions.RelativeDistinguishedName(attributes: Iterable[cryptography.x509.name.NameAttribute])¶ Bases:
cryptography.x509.name.RelativeDistinguishedNameWrapper 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
-
classmethod
-
class
autocsr.extensions.SubjectAlternativeName(general_names: Iterable[cryptography.x509.general_name.GeneralName])¶ Bases:
cryptography.x509.extensions.SubjectAlternativeNameWrapper 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
-
classmethod
-
class
autocsr.extensions.SubjectInformationAccess(descriptions: Iterable[cryptography.x509.extensions.AccessDescription])¶ Bases:
cryptography.x509.extensions.SubjectInformationAccessWrapper 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
-
classmethod
-
class
autocsr.extensions.SubjectKeyIdentifier(digest: bytes)¶ Bases:
cryptography.x509.extensions.SubjectKeyIdentifierWrapper 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
-
classmethod
-
class
autocsr.extensions.TLSFeature(features: Iterable[cryptography.x509.extensions.TLSFeatureType])¶ Bases:
cryptography.x509.extensions.TLSFeatureWrapper 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
-
classmethod
-
class
autocsr.extensions.UniformResourceIdentifier(value: str)¶ Bases:
cryptography.x509.general_name.UniformResourceIdentifierWrapper 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
-
classmethod
-
class
autocsr.extensions.UserNotice(notice_reference: Optional[cryptography.x509.extensions.NoticeReference], explicit_text: Optional[str])¶ Bases:
cryptography.x509.extensions.UserNoticeWrapper 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]
-
classmethod
autocsr.hsm module¶
autocsr.oid module¶
Create wrapped Object Identifiers.
-
class
autocsr.oid.ObjectIdentifier(dotted_string: str)¶ Bases:
cryptography.hazmat._oid.ObjectIdentifierA 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
-
classmethod