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: ObjectIdentifier, access_location: GeneralName)
Bases:
AccessDescriptionWrapper for AccessDescription from a config file.
- classmethod from_proto(description: 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[AccessDescription])
Bases:
AuthorityInformationAccessWrapper for AuthorityInformationAccess Extension from config file.
- classmethod from_proto(extension: 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[GeneralName]], authority_cert_serial_number: Optional[int])
Bases:
AuthorityKeyIdentifierWrapper for AuthorityKeyIdentifier Extension from config file.
- classmethod from_proto(extension: 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:
BasicConstraintsWrapper for BasicConstraints Extension from config file.
- classmethod from_proto(extension: 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[DistributionPoint])
Bases:
CRLDistributionPointsWrapper for CRLDistributionPoints Extension from config file.
- classmethod from_proto(extension: 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[PolicyInformation])
Bases:
CertificatePoliciesWrapper for CertificatePolicies Extension from config file.
- classmethod from_proto(extension: 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:
DNSNameWrapper for DNSName general name from config file.
- classmethod from_proto(name: 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: Name)
Bases:
DirectoryNameWrapper for DirectoryName general name from config file.
- classmethod from_proto(name: 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[GeneralName]], relative_name: Optional[RelativeDistinguishedName], reasons: Optional[FrozenSet[ReasonFlags]], crl_issuer: Optional[Iterable[GeneralName]])
Bases:
DistributionPointWrapper for DistributionPoint from config file.
- classmethod from_proto(dist: 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[ObjectIdentifier])
Bases:
ExtendedKeyUsageWrapper for ExtendedKeyUsage extension from config file.
- classmethod from_proto(extension: 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:
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: Extension) 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: Extension) 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[DistributionPoint])
Bases:
FreshestCRLWrapper for FreshestCRL Extension from config file.
- classmethod from_proto(extension: 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:
objectFactory for creating General Names from a config.
- static from_proto(name: GeneralName) 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[IPv4Address, IPv6Address, IPv4Network, IPv6Network])
Bases:
IPAddressWrapper for an IPAddress general name from config file.
- classmethod from_proto(name: 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:
InhibitAnyPolicyWrapper for InhibitAnyPolicy Extension from config file.
- classmethod from_proto(extension: 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[GeneralName])
Bases:
IssuerAlternativeNameWrapper for IssuerAlternativeName Extension from config file.
- classmethod from_proto(extension: 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:
KeyUsageWrapper for KeyUsage Extension from config file.
- classmethod from_proto(extension: 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:
NameWrapper for Name from config file.
- classmethod from_proto(name: 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:
NameAttributeWrapper for NameAttribute from config file.
- classmethod from_proto(attribute: 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[GeneralName]], excluded_subtrees: Optional[Iterable[GeneralName]])
Bases:
NameConstraintsWrapper for a NameConstraints extension from a config file.
- classmethod from_proto(extension: 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:
NoticeReferenceWrapper for NoticeReference from config file.
- classmethod from_proto(notice: 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: ObjectIdentifier, value: bytes)
Bases:
OtherNameWrapper for an OtherName general name from config file.
- classmethod from_proto(name: 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:
PolicyConstraintsWrapper for PolicyConstraints Extension from config file.
- classmethod from_proto(extension: 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: ObjectIdentifier, policy_qualifiers: Optional[Iterable[Union[str, UserNotice]]])
Bases:
PolicyInformationWrapper for PolicyInformation from config file.
- classmethod from_proto(policies: Iterable[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:
RFC822NameWrapper for RFC822Name general name from config file.
- classmethod from_proto(name: 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:
objectMap int enum ReasonFlags to exceptions.ReasonFlag enums.
- ExtFlag
alias of
ReasonFlags
- ProtoFlag = <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object>
- flags = {0: ReasonFlags.unspecified, 1: ReasonFlags.key_compromise, 2: ReasonFlags.ca_compromise, 3: ReasonFlags.affiliation_changed, 4: ReasonFlags.superseded, 5: ReasonFlags.cessation_of_operation, 7: ReasonFlags.privilege_withdrawn, 8: ReasonFlags.aa_compromise, 9: ReasonFlags.remove_from_crl}
- static from_proto(reason: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f9bf1175510>) 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: ObjectIdentifier)
Bases:
RegisteredIDWrapper for RegisteredID general name from config file.
- classmethod from_proto(name: 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[NameAttribute])
Bases:
RelativeDistinguishedNameWrapper for RelativeDistinguishedName from config file.
- classmethod from_proto(name: 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[GeneralName])
Bases:
SubjectAlternativeNameWrapper for SubjectAlternativeName Extension from config file.
- classmethod from_proto(extension: 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[AccessDescription])
Bases:
SubjectInformationAccessWrapper for SubjectInformationAccess Extension from config file.
- classmethod from_proto(extension: 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:
SubjectKeyIdentifierWrapper for SubjectKeyIdentifier Extension from config file.
- classmethod from_proto(extension: 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[TLSFeatureType])
Bases:
TLSFeatureWrapper for TLSFeature Extension from config file.
- classmethod from_proto(extension: 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:
UniformResourceIdentifierWrapper for UniformResourceIdentifier general name from config file.
- classmethod from_proto(name: 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[NoticeReference], explicit_text: Optional[str])
Bases:
UserNoticeWrapper for UserNotice from config file.
- classmethod from_proto(notices: Iterable[UserNotice]) Iterable[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:
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