How to create X509 certificates for testing

This page provides a few methods to create X509 certificates for testing purposes.

Using OpenSSL

For this you need to have OpenSSL installed. On Windows, convenient installers are available at or

Self-signed certificates

Many tutorials exist on the web, such as these:

The easiest solution I've found so far is that one-line example:

openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout test.pem -out test.pem

Or if you prefer to have separate files for the private key and the certificate:

openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout test.key -out test.cert


Certificates with a CA

Other options



Options d'affichage des commentaires

Sélectionnez la méthode d'affichage des commentaires que vous préférez, puis cliquez sur "Sauvegarder les paramètres" pour activer vos changements.

win openssl-warning-cant-open-config-file-usrlocalsslopensslcnf

On windows, to prevent error message concerning openssl.cnf :
You should fix env var :

for exemple...

Ref :