opsicommon.ssl package

Submodules

opsicommon.ssl.common module

ssl

opsicommon.ssl.common.as_pem(cert_or_key, passphrase=None)
Parameters:
  • cert_or_key (Certificate | RSAPrivateKey)

  • passphrase (str | None)

Return type:

str

opsicommon.ssl.common.create_ca(*, subject, valid_days, key=None, bits=4096, permitted_domains=None, ca_key=None, ca_cert=None)
Parameters:
  • subject (Name | dict[str, str])

  • valid_days (int)

  • key (RSAPrivateKey | None)

  • bits (int)

  • permitted_domains (list[str] | set[str] | tuple[str] | None)

  • ca_key (RSAPrivateKey | None)

  • ca_cert (Certificate | None)

Return type:

tuple[Certificate, RSAPrivateKey]

opsicommon.ssl.common.create_server_cert(*, subject, valid_days, ip_addresses, hostnames, ca_key, ca_cert, key=None, bits=4096)
Parameters:
  • subject (Name | dict[str, str])

  • valid_days (int)

  • ip_addresses (set)

  • hostnames (set)

  • ca_key (RSAPrivateKey)

  • ca_cert (Certificate)

  • key (RSAPrivateKey | None)

  • bits (int)

Return type:

tuple[Certificate, RSAPrivateKey]

opsicommon.ssl.common.create_x509_name(subject=None)
Parameters:

subject (dict[str, str | None] | None)

Return type:

Name

opsicommon.ssl.common.is_self_signed(ca_cert)
Parameters:

ca_cert (Certificate)

Return type:

bool

opsicommon.ssl.common.load_key(key_file, passphrase=None)
Parameters:
  • key_file (str | Path)

  • passphrase (str | None)

Return type:

RSAPrivateKey

opsicommon.ssl.common.subject_to_dict(subject)
Parameters:

subject (Name)

Return type:

dict[str, str]

opsicommon.ssl.common.x509_name_from_dict(subject)
Parameters:

subject (dict[str, str | None])

Return type:

Name

opsicommon.ssl.common.x509_name_to_dict(x509_name)
Parameters:

x509_name (Name)

Return type:

dict[str, str]

opsicommon.ssl.darwin module

This file is part of opsi - https://www.opsi.org

opsicommon.ssl.darwin.install_ca(ca_cert)
Parameters:

ca_cert (Certificate)

Return type:

None

opsicommon.ssl.darwin.load_ca(subject_name)
Parameters:

subject_name (str)

Return type:

Certificate | None

opsicommon.ssl.darwin.load_cas(subject_name)
Parameters:

subject_name (str)

Return type:

Generator[Certificate, None, None]

opsicommon.ssl.darwin.remove_ca(subject_name, sha1_fingerprint=None)
Parameters:
  • subject_name (str)

  • sha1_fingerprint (str | None)

Return type:

bool

opsicommon.ssl.linux module

This file is part of opsi - https://www.opsi.org

opsicommon.ssl.linux.install_ca(ca_cert)
Parameters:

ca_cert (Certificate)

Return type:

None

opsicommon.ssl.linux.load_ca(subject_name)
Parameters:

subject_name (str)

Return type:

Certificate | None

opsicommon.ssl.linux.load_cas(subject_name)
Parameters:

subject_name (str)

Return type:

Generator[Certificate, None, None]

opsicommon.ssl.linux.remove_ca(subject_name, sha1_fingerprint=None)
Parameters:
  • subject_name (str)

  • sha1_fingerprint (str | None)

Return type:

bool

opsicommon.ssl.windows module

Module contents

ssl

opsicommon.ssl.as_pem(cert_or_key, passphrase=None)
Parameters:
  • cert_or_key (Certificate | RSAPrivateKey)

  • passphrase (str | None)

Return type:

str

opsicommon.ssl.create_ca(*, subject, valid_days, key=None, bits=4096, permitted_domains=None, ca_key=None, ca_cert=None)
Parameters:
  • subject (Name | dict[str, str])

  • valid_days (int)

  • key (RSAPrivateKey | None)

  • bits (int)

  • permitted_domains (list[str] | set[str] | tuple[str] | None)

  • ca_key (RSAPrivateKey | None)

  • ca_cert (Certificate | None)

Return type:

tuple[Certificate, RSAPrivateKey]

opsicommon.ssl.create_server_cert(*, subject, valid_days, ip_addresses, hostnames, ca_key, ca_cert, key=None, bits=4096)
Parameters:
  • subject (Name | dict[str, str])

  • valid_days (int)

  • ip_addresses (set)

  • hostnames (set)

  • ca_key (RSAPrivateKey)

  • ca_cert (Certificate)

  • key (RSAPrivateKey | None)

  • bits (int)

Return type:

tuple[Certificate, RSAPrivateKey]

opsicommon.ssl.create_x509_name(subject=None)
Parameters:

subject (dict[str, str | None] | None)

Return type:

Name

opsicommon.ssl.install_ca(ca_cert)
Parameters:

ca_cert (Certificate)

Return type:

None

opsicommon.ssl.is_self_signed(ca_cert)
Parameters:

ca_cert (Certificate)

Return type:

bool

opsicommon.ssl.load_ca(subject_name)
Parameters:

subject_name (str)

Return type:

Certificate | None

opsicommon.ssl.load_cas(subject_name)
Parameters:

subject_name (str)

Return type:

Generator[Certificate, None, None]

opsicommon.ssl.load_key(key_file, passphrase=None)
Parameters:
  • key_file (str | Path)

  • passphrase (str | None)

Return type:

RSAPrivateKey

opsicommon.ssl.remove_ca(subject_name, sha1_fingerprint=None)
Parameters:
  • subject_name (str)

  • sha1_fingerprint (str | None)

Return type:

bool

opsicommon.ssl.x509_name_from_dict(subject)
Parameters:

subject (dict[str, str | None])

Return type:

Name

opsicommon.ssl.x509_name_to_dict(x509_name)
Parameters:

x509_name (Name)

Return type:

dict[str, str]