Convert certificate formats using OpenSSL

From Tech-Wiki
Revision as of 22:04, 5 July 2018 by Fabricio.Lima (Talk | contribs) (Created page with "Category:Linux '''Method 1''' Generate the private key # openssl genrsa -aes256 -out server.key 2048 Adjust the key to avoid asking for password on Apache startup: # o...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Method 1

Generate the private key

# openssl genrsa -aes256 -out server.key 2048

Adjust the key to avoid asking for password on Apache startup:

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

Generate the Certificate Request based on this previous request using provided key:

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

If you are working in a test environment, you can create Self-Signed certificates (non-valid)

# openssl req -new -sha256 -x509 -days 1825 -key server.key -out server.crt 


Method 2

Generate CSR - Certificate Request and private key at once:

# openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr

If you are working in a test environment, you can create Self-Signed certificates (non-valid):

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