summaryrefslogtreecommitdiff
path: root/src/pki/man/pki.1.in
blob: f347031b4a522e10fa20677d94199234459175cc (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.TH PKI 1 "2013-07-31" "@PACKAGE_VERSION@" "strongSwan"
.
.SH "NAME"
.
pki \- Simple public key infrastructure (PKI) management tool
.
.SH "SYNOPSIS"
.
.SY "pki"
.I command
.RI [ option\~ .\|.\|.]
.YS
.
.SY "pki"
.B \-h
|
.B \-\-help
.YS
.
.SH "DESCRIPTION"
.
.B pki
is a suite of commands that allow you to manage a simple public key
infrastructure (PKI).
.P
Generate RSA and ECDSA key pairs, create PKCS#10 certificate requests
containing subjectAltNames, create X.509 self-signed end-entity and root CA
certificates, issue end-entity and intermediate CA certificates signed by the
private key of a CA and containing subjectAltNames, CRL distribution points
and URIs of OCSP servers. You can also extract raw public keys from private
keys, certificate requests and certificates and compute two kinds of SHA-1-based
key IDs.
.
.SH "COMMANDS"
.
.TP
.B "\-h, \-\-help"
Prints usage information and a short summary of the available commands.
.TP
.B "\-g, \-\-gen"
Generate a new private key.
.TP
.B "\-s, \-\-self"
Create a self-signed certificate.
.TP
.B "\-i, \-\-issue"
Issue a certificate using a CA certificate and key.
.TP
.B "\-c, \-\-signcrl"
Issue a CRL using a CA certificate and key.
.TP
.B "\-z, \-\-acert"
Issue an attribute certificate.
.TP
.B "\-r, \-\-req"
Create a PKCS#10 certificate request.
.TP
.B "\-7, \-\-pkcs7"
Provides PKCS#7 wrap/unwrap functions.
.TP
.B "\-k, \-\-keyid"
Calculate key identifiers of a key or certificate.
.TP
.B "\-a, \-\-print"
Print a credential (key, certificate etc.) in human readable form.
.TP
.B "\-p, \-\-pub"
Extract a public key from a private key or certificate.
.TP
.B "\-v, \-\-verify"
Verify a certificate using a CA certificate.
.
.SH "EXAMPLES"
.
.SS "Generating a CA Certificate"
.
The first step is to generate a private key using the
.B \-\-gen
command. By default this generates a 2048-bit RSA key.
.PP
.EX
  pki \-\-gen > ca_key.der
.EE
.PP
This key is used to create the self-signed CA certificate, using the
.B \-\-self
command. The distinguished name should be adjusted to your needs.
.PP
.EX
  pki \-\-self \-\-ca \-\-in ca_key.der \\
      \-\-dn "C=CH, O=strongSwan, CN=strongSwan CA" > ca_cert.der
.EE
.PP
.
.SS "Generating End-Entity Certificates"
.
With the root CA certificate and key at hand end-entity certificates for clients
and servers can be issued. Similarly intermediate CA certificates can be issued,
which in turn can issue other certificates.
To generate a certificate for a server, we start by generating a private key.
.PP
.EX
  pki \-\-gen > server_key.der
.EE
.PP
The public key will be included in the certificate so lets extract that from the
private key.
.PP
.EX
  pki \-\-pub \-\-in server_key.der > server_pub.der
.EE
.PP
The following command will use the CA certificate and private key to issue the
certificate for this server. Adjust the distinguished name, subjectAltName(s)
and flags as needed (check
.BR pki\ \-\-issue (8)
for more options).
.PP
.EX
  pki \-\-issue \-\-in server_pub.der \-\-cacert ca_cert.der \\
      \-\-cakey ca_key.der \-\-dn "C=CH, O=strongSwan, CN=VPN Server" \\
      \-\-san vpn.strongswan.org \-\-flag serverAuth > server_cert.der
.EE
.PP
Instead of storing the public key in a separate
file, the output of
.B \-\-pub
may also be piped directly into the above command.
.
.SS "Generating Certificate Revocation Lists (CRL)"
.
If end-entity certificates have to be revoked, CRLs may be generated using
the
.B \-\-signcrl
command.
.PP
.EX
  pki \-\-signcrl \-\-cacert ca_cert.der \-\-cakey ca_key.der \\
      \-\-reason superseded \-\-cert server_cert.der > crl.der
.EE
.PP
The certificate given with \-\-cacert must be either a CA certificate or a
certificate with the
.I crlSign
extended key usage (\-\-flag crlSign). URIs to CRLs may be included in issued
certificates with the \-\-crl option.
.
.SH "SEE ALSO"
.
.BR pki\ \-\-gen (1),
.BR pki\ \-\-self (1),
.BR pki\ \-\-issue (1),
.BR pki\ \-\-signcrl (1),
.BR pki\ \-\-acert (1),
.BR pki\ \-\-req (1),
.BR pki\ \-\-pkcs7 (1),
.BR pki\ \-\-keyid (1),
.BR pki\ \-\-print (1),
.BR pki\ \-\-pub (1),
.BR pki\ \-\-verify (1)