UBUNTU DUMP‎ > ‎

Create SSl Certificate

posted 6 Jul 2016, 02:01 by Donald Ross   [ updated 7 Jul 2016, 08:31 ]
SSL cert on Ubuntu (test)

sudo apt-get install openssl

run the first two commands one by one as openssl will prompt for a passphrase.
openssl genrsa -des3 -out server.key 2048
openssl rsa -in server.key -out server.key

Replace 'localhost' with whatever domain you require.
openssl req -sha256 -new -key server.key -out server.csr -subj '/CN=testcert'
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

To combine the two into a .pem file:
cat server.crt server.key > cert.pem


--------------


donald@ubuntuWEB1:~$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout Tester.key -out Tester.crt
Generating a 2048 bit RSA private key
......................................................................................................................................+++
...............+++
writing new private key to 'Tester.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:UK
State or Province Name (full name) [Some-State]:Livinston
Locality Name (eg, city) []:Livingston
Organization Name (eg, company) [Internet Widgits Pty Ltd]:DDRcomputing
Organizational Unit Name (eg, section) []:IT
Common Name (e.g. server FQDN or YOUR name) []:tester.ddrcomputing.co.uk
Email Address []:test@ddrcomputing.co.uk
donald@ubuntuWEB1:~$ ls
Tester.crt  Tester.key
donald@ubuntuWEB1:~$

-----------------

openssl pkcs12 -export -out Tester.pfx -inkey Tester.key -in Tester.crt


Comments