python_template_server.certificate_handler

Generate self-signed SSL certificate for local development.

Classes

CertificateHandler(certificate_config)

Handles SSL certificate generation and management.

class python_template_server.certificate_handler.CertificateHandler(certificate_config)[source]

Handles SSL certificate generation and management.

__init__(certificate_config)[source]

Initialize the CertificateHandler.

property certificate_subject: Name

Define the subject for the self-signed certificate.

static new_private_key()[source]

Generate a new RSA private key.

Return type:

RSAPrivateKey

write_to_key_file(data)[source]

Write data to the key file.

Return type:

None

write_to_cert_file(data)[source]

Write data to the certificate file.

Return type:

None

generate_self_signed_cert()[source]

Generate a self-signed certificate and private key.

Raises:
  • SystemExit – If certificate directory cannot be created

  • OSError – If certificate files cannot be written

  • PermissionError – If insufficient permissions to write certificate files

Return type:

None