summaryrefslogtreecommitdiff
path: root/test/basicserver/testfiles/key-creation.txt
blob: 51f4eb7741d03f8bf71010ff04934311b980f341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$ openssl genrsa -out rootkey.pem 1024

$ openssl req -new -key rootkey.pem -sha1 -out rootreq.pem
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) []:GB
State or Province Name (full name) []:London
Locality Name (eg, city) []:London
Organization Name (eg, company) []:Test
Organizational Unit Name (eg, section) []:basic server
Common Name (eg, fully qualified host name) []:ROOT
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

$ openssl x509 -req -in rootreq.pem -sha1 -extensions v3_ca -signkey rootkey.pem -out rootcert.pem -days 10000
Signature ok
subject=/C=GB/ST=London/L=London/O=Test/OU=basic server/CN=ROOT
Getting Private key

$ cp rootcert.pem serverTrustedCAs.pem
$ cp rootcert.pem clientTrustedCAs.pem

$ openssl genrsa -out clientPrivKey.pem 1024
$ openssl req -new -key clientPrivKey.pem -sha1 -out clientReq.pem
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) []:GB
State or Province Name (full name) []:London
Locality Name (eg, city) []:London
Organization Name (eg, company) []:Test
Organizational Unit Name (eg, section) []:basic server
Common Name (eg, fully qualified host name) []:CLIENT
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

$ cat rootcert.pem rootkey.pem > root.pem

$ echo 01 > root.srl

$ openssl x509 -req -in clientReq.pem -sha1 -extensions usr_crt -CA root.pem -CAkey root.pem -out clientCerts.pem -days 10000

$ openssl genrsa -out serverPrivKey.pem 1024
$ openssl req -new -key serverPrivKey.pem -sha1 -out serverReq.pem
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) []:GB
State or Province Name (full name) []:London
Locality Name (eg, city) []:London
Organization Name (eg, company) []:Test
Organizational Unit Name (eg, section) []:basic server
Common Name (eg, fully qualified host name) []:SERVER
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

$ openssl x509 -req -in serverReq.pem -sha1 -extensions usr_crt -CA root.pem -CAkey root.pem -out serverCerts.pem -days 10000