The best-known tool for generating certificates on Linux is part of the OpenSSL toolkit. Nearly every application that implements SSL/TLS, such as the Apache and Nginx HTTP servers, uses it.
A digital certificate, required for the asymmetric encryption used between an HTTP server and a client, can usually be obtained in two ways: create a self-signed certificate, whose authenticity is not guaranteed by a certificate authority; or create a CSR for a certificate authority to use when issuing a signed certificate whose authenticity it guarantees.
openssl req -new -newkey rsa:2048 -sha256 -nodes -keyout chave.key -out requisicao.csr
Keep the private key safe. If you lose it, you will not be able to use the certificate issued by your certificate authority.
Because of a Google Chrome update, generate certificates with the
-sha256parameter to avoid errors with SHA1 certificates, which have been rejected since November 2014.
openssl req -in requisicao.csr -noout -text
openssl req -key chavePrivada.key -new -out requisicao.csr
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout chavePrivada.key -out certificado.crt
openssl x509 -in certificado.crt -text -noout
openssl rsa -in chave.key -out chavePrivadaSemSenha.key
openssl x509 -noout -modulus -in certificado.crt | openssl md5openssl rsa -noout -modulus -in chave.key | openssl md5openssl req -noout -modulus -in requisicao.csr | openssl md5