Carl Younger
Carl Younger

Reputation: 3070

How to generate an SSL certificate in Python3

I need to generate self-signed certs for using HTTPS on a single-user web server. It's important that the user is able to set the certificate up however they like. They need to be able to set the Common Name and so on.

In an pure Python3 environment, how do you generate a self-signed certificate?

Upvotes: 2

Views: 2142

Answers (1)

Domecraft
Domecraft

Reputation: 1661

To create self-signed certificate you could use openssl as it is available on all major OSes.

$ openssl req -new -x509 -key privkey.pem -out cert.pem -days 1095

Try the above code in python and see if it works.

Upvotes: -1

Related Questions