How to Make Self Signed Certificate with OpenSSL?
572

To create a self-signed SSL/TLS certificate using OpenSSL, follow these steps:

  1. Install OpenSSL on your system, if it's not already installed.

  2. Open a terminal or command prompt and navigate to the directory where you want to create the certificate.

  3. Generate a private key using the following command:

    openssl genrsa -des3 -out server.key 2048

    This will generate a private key with 2048 bits, protected by a passphrase.

  4. Generate a certificate signing request (CSR) using the following command:

    openssl req -new -key server.key -out server.csr

    This will generate a CSR file, which you will need to sign with your private key.

  5. Remove the passphrase from the private key using the following command:

    openssl rsa -in server.key -out server.key

    This will remove the passphrase from the private key, so you won't need to enter it every time you use the certificate.

  6. Generate a self-signed certificate using the following command:

    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

    This will create a self-signed SSL/TLS certificate that is valid for 365 days.

  7. Verify that the certificate was created successfully using the following command:

    openssl x509 -in server.crt -text

    This will display the details of the certificate, including the subject, issuer, and expiration date.

That's it! You should now have a self-signed SSL/TLS certificate that you can use for testing or development purposes. Note that self-signed certificates are not trusted by default, so you may need to add the certificate to your trusted certificate store or configure your application to accept self-signed certificates.

If you are looking for consultation, fill the Contact Form below.
The present is theirs; the future, for which I really worked, is mine. Nikola Tesla
Haluk YAMANER - Personal
Contact Form
You must complete Security Verification to submit your form.