module cli.openssl

Short summary

module mathenjeu.cli.openssl

Starts an app locally to test it.

source on GitHub



truncated documentation


Creates a signed certificate.


Starts an app locally to test it.

source on GitHub

mathenjeu.cli.openssl.create_self_signed_cert(keyfile='key.pem', certfile='cert.pem', country='FR', state='Paris', location='Paris', organization='mathenjeu', cn='mathenjeu', organizational_unit_name=None, email=None, size=4096, days=365, algo='sha256', fLOG=<built-in function print>)

Creates a signed certificate.

  • keyfile – key file

  • certfile – certificate file

  • country – country

  • state – state

  • location – location

  • cn – common name

  • organization – organization

  • organizational_unit_name – organizational unit name (can be empty)

  • email – email (can be empty)

  • size – key size

  • days – days it is valid

  • algo – algorithm

  • fLOG – logging function

See also How to generate a certificate using pyOpenSSL to make it secure connection?, How to serve HTTP/2 using Python.

Creates a signed certificate

The command line creates a certificate used later by a service such as hypercorn or waitress. Example:

python -m mathenjeu create_self_signed_cert --keyfile=key.pem --certfile=cert.pem


python -m mathenjeu create_self_signed_cert --help


usage: create_self_signed_cert [-h] [-k KEYFILE] [-c CERTFILE] [-co COUNTRY]
                               [-s STATE] [-l LOCATION] [-o ORGANIZATION]
                               [--cn CN] [-or ORGANIZATIONAL_UNIT_NAME]
                               [-e EMAIL] [-si SIZE] [-d DAYS] [-a ALGO]

Creates a signed certificate.

optional arguments:
  -h, --help            show this help message and exit
  -k KEYFILE, --keyfile KEYFILE
                        key file (default: key.pem)
  -c CERTFILE, --certfile CERTFILE
                        certificate file (default: cert.pem)
  -co COUNTRY, --country COUNTRY
                        country (default: FR)
  -s STATE, --state STATE
                        state (default: Paris)
  -l LOCATION, --location LOCATION
                        location (default: Paris)
                        organization (default: mathenjeu)
  --cn CN               common name (default: mathenjeu)
                        organizational unit name (can be empty) (default: )
  -e EMAIL, --email EMAIL
                        email (can be empty) (default: )
  -si SIZE, --size SIZE
                        key size (default: 4096)
  -d DAYS, --days DAYS  days it is valid (default: 365)
  -a ALGO, --algo ALGO  algorithm (default: sha256)

source on GitHub