Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 2.11 KB

File metadata and controls

44 lines (33 loc) · 2.11 KB

python-cert-authority

Python Certification Authority

With the brief assistance of ChatGPT (with the cryptography library) - here are two python scripts that'll help you make your own certification authority.

I used Python 3.11.3 to make this - please use 3.11+ for the best compatibility.

  1. Download both .py files
  2. Open CMD or Powershell (Windows) - or your chosen terminal for Linux.
  3. Execute generate_ca.py with your chosen arguments.
  4. Execute generate_cert_with_authority.py with your chosen arguments.
  5. Once you have both certificates - since they're self signed, your web browser won't like it - use the import_cert_windows.py to help. (For Linux: use Google as some distros do it different than others).

Generating the CA This is the syntax for generating your CA cert.

python3 generate_ca.py <common_name> <org_name> <town_name> <state_name> <country_initials>

Let's say I want to generate a certificate for GitHub, the command would be:

python3 generate_ca.py 'GitHub' 'GitHub' 'San Francisco' 'California' 'US' It will do its job and then export the private key and certificate (both as .pem and as .crt)


Generating a certificate in that CA This is the syntax for generating a certificate within your CA

python3 generate_cert_with_authority.py <domain_name>

Now let's create a certificate for example.com python3 generate_cert_with_authority.py 'example.com'

You now have these files: ca_cert.pem, ca_cert.crt, ca_cert.crt, github.com.crt, github.com.pem, github.com_key.pem. If you do not, something has gone wrong.



Import your certificate into your computer Use the import_cert_windows.py script for Windows - for Linux, please use Google to help you - all distros are somewhat different, and the process will not be the same.

DISCLAIMER: The certificate you need to import is your CA cert - if you import the certficate for the individual website - it will not function properly.


Upcoming updates - Allow users to specify how long certificate should be issued for.