xref: /minix3/crypto/external/bsd/openssl/dist/doc/apps/x509.pod (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc
2ebfedea0SLionel Sambuc=pod
3ebfedea0SLionel Sambuc
4ebfedea0SLionel Sambuc=head1 NAME
5ebfedea0SLionel Sambuc
6ebfedea0SLionel Sambucx509 - Certificate display and signing utility
7ebfedea0SLionel Sambuc
8ebfedea0SLionel Sambuc=head1 SYNOPSIS
9ebfedea0SLionel Sambuc
10ebfedea0SLionel SambucB<openssl> B<x509>
11ebfedea0SLionel Sambuc[B<-inform DER|PEM|NET>]
12ebfedea0SLionel Sambuc[B<-outform DER|PEM|NET>]
13ebfedea0SLionel Sambuc[B<-keyform DER|PEM>]
14ebfedea0SLionel Sambuc[B<-CAform DER|PEM>]
15ebfedea0SLionel Sambuc[B<-CAkeyform DER|PEM>]
16ebfedea0SLionel Sambuc[B<-in filename>]
17ebfedea0SLionel Sambuc[B<-out filename>]
18ebfedea0SLionel Sambuc[B<-serial>]
19ebfedea0SLionel Sambuc[B<-hash>]
20ebfedea0SLionel Sambuc[B<-subject_hash>]
21ebfedea0SLionel Sambuc[B<-issuer_hash>]
22*0a6a1f1dSLionel Sambuc[B<-ocspid>]
23ebfedea0SLionel Sambuc[B<-subject>]
24ebfedea0SLionel Sambuc[B<-issuer>]
25ebfedea0SLionel Sambuc[B<-nameopt option>]
26ebfedea0SLionel Sambuc[B<-email>]
27ebfedea0SLionel Sambuc[B<-ocsp_uri>]
28ebfedea0SLionel Sambuc[B<-startdate>]
29ebfedea0SLionel Sambuc[B<-enddate>]
30ebfedea0SLionel Sambuc[B<-purpose>]
31ebfedea0SLionel Sambuc[B<-dates>]
32*0a6a1f1dSLionel Sambuc[B<-checkend num>]
33ebfedea0SLionel Sambuc[B<-modulus>]
34ebfedea0SLionel Sambuc[B<-pubkey>]
35ebfedea0SLionel Sambuc[B<-fingerprint>]
36ebfedea0SLionel Sambuc[B<-alias>]
37ebfedea0SLionel Sambuc[B<-noout>]
38ebfedea0SLionel Sambuc[B<-trustout>]
39ebfedea0SLionel Sambuc[B<-clrtrust>]
40ebfedea0SLionel Sambuc[B<-clrreject>]
41ebfedea0SLionel Sambuc[B<-addtrust arg>]
42ebfedea0SLionel Sambuc[B<-addreject arg>]
43ebfedea0SLionel Sambuc[B<-setalias arg>]
44ebfedea0SLionel Sambuc[B<-days arg>]
45ebfedea0SLionel Sambuc[B<-set_serial n>]
46ebfedea0SLionel Sambuc[B<-signkey filename>]
47*0a6a1f1dSLionel Sambuc[B<-passin arg>]
48ebfedea0SLionel Sambuc[B<-x509toreq>]
49ebfedea0SLionel Sambuc[B<-req>]
50ebfedea0SLionel Sambuc[B<-CA filename>]
51ebfedea0SLionel Sambuc[B<-CAkey filename>]
52ebfedea0SLionel Sambuc[B<-CAcreateserial>]
53ebfedea0SLionel Sambuc[B<-CAserial filename>]
54ebfedea0SLionel Sambuc[B<-text>]
55*0a6a1f1dSLionel Sambuc[B<-certopt option>]
56ebfedea0SLionel Sambuc[B<-C>]
57ebfedea0SLionel Sambuc[B<-md2|-md5|-sha1|-mdc2>]
58ebfedea0SLionel Sambuc[B<-clrext>]
59ebfedea0SLionel Sambuc[B<-extfile filename>]
60ebfedea0SLionel Sambuc[B<-extensions section>]
61ebfedea0SLionel Sambuc[B<-engine id>]
62ebfedea0SLionel Sambuc
63ebfedea0SLionel Sambuc=head1 DESCRIPTION
64ebfedea0SLionel Sambuc
65ebfedea0SLionel SambucThe B<x509> command is a multi purpose certificate utility. It can be
66ebfedea0SLionel Sambucused to display certificate information, convert certificates to
67ebfedea0SLionel Sambucvarious forms, sign certificate requests like a "mini CA" or edit
68ebfedea0SLionel Sambuccertificate trust settings.
69ebfedea0SLionel Sambuc
70ebfedea0SLionel SambucSince there are a large number of options they will split up into
71ebfedea0SLionel Sambucvarious sections.
72ebfedea0SLionel Sambuc
73ebfedea0SLionel Sambuc=head1 OPTIONS
74ebfedea0SLionel Sambuc
75ebfedea0SLionel Sambuc=head2 INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS
76ebfedea0SLionel Sambuc
77ebfedea0SLionel Sambuc=over 4
78ebfedea0SLionel Sambuc
79ebfedea0SLionel Sambuc=item B<-inform DER|PEM|NET>
80ebfedea0SLionel Sambuc
81ebfedea0SLionel SambucThis specifies the input format normally the command will expect an X509
82ebfedea0SLionel Sambuccertificate but this can change if other options such as B<-req> are
83ebfedea0SLionel Sambucpresent. The DER format is the DER encoding of the certificate and PEM
84ebfedea0SLionel Sambucis the base64 encoding of the DER encoding with header and footer lines
85ebfedea0SLionel Sambucadded. The NET option is an obscure Netscape server format that is now
86ebfedea0SLionel Sambucobsolete.
87ebfedea0SLionel Sambuc
88ebfedea0SLionel Sambuc=item B<-outform DER|PEM|NET>
89ebfedea0SLionel Sambuc
90ebfedea0SLionel SambucThis specifies the output format, the options have the same meaning as the
91ebfedea0SLionel SambucB<-inform> option.
92ebfedea0SLionel Sambuc
93ebfedea0SLionel Sambuc=item B<-in filename>
94ebfedea0SLionel Sambuc
95ebfedea0SLionel SambucThis specifies the input filename to read a certificate from or standard input
96ebfedea0SLionel Sambucif this option is not specified.
97ebfedea0SLionel Sambuc
98ebfedea0SLionel Sambuc=item B<-out filename>
99ebfedea0SLionel Sambuc
100ebfedea0SLionel SambucThis specifies the output filename to write to or standard output by
101ebfedea0SLionel Sambucdefault.
102ebfedea0SLionel Sambuc
103ebfedea0SLionel Sambuc=item B<-md2|-md5|-sha1|-mdc2>
104ebfedea0SLionel Sambuc
105ebfedea0SLionel Sambucthe digest to use. This affects any signing or display option that uses a message
106ebfedea0SLionel Sambucdigest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options. If not
107ebfedea0SLionel Sambucspecified then SHA1 is used. If the key being used to sign with is a DSA key
108ebfedea0SLionel Sambucthen this option has no effect: SHA1 is always used with DSA keys.
109ebfedea0SLionel Sambuc
110ebfedea0SLionel Sambuc=item B<-engine id>
111ebfedea0SLionel Sambuc
112ebfedea0SLionel Sambucspecifying an engine (by its unique B<id> string) will cause B<x509>
113ebfedea0SLionel Sambucto attempt to obtain a functional reference to the specified engine,
114ebfedea0SLionel Sambucthus initialising it if needed. The engine will then be set as the default
115ebfedea0SLionel Sambucfor all available algorithms.
116ebfedea0SLionel Sambuc
117ebfedea0SLionel Sambuc=back
118ebfedea0SLionel Sambuc
119ebfedea0SLionel Sambuc=head2 DISPLAY OPTIONS
120ebfedea0SLionel Sambuc
121ebfedea0SLionel SambucNote: the B<-alias> and B<-purpose> options are also display options
122ebfedea0SLionel Sambucbut are described in the B<TRUST SETTINGS> section.
123ebfedea0SLionel Sambuc
124ebfedea0SLionel Sambuc=over 4
125ebfedea0SLionel Sambuc
126ebfedea0SLionel Sambuc=item B<-text>
127ebfedea0SLionel Sambuc
128ebfedea0SLionel Sambucprints out the certificate in text form. Full details are output including the
129ebfedea0SLionel Sambucpublic key, signature algorithms, issuer and subject names, serial number
130ebfedea0SLionel Sambucany extensions present and any trust settings.
131ebfedea0SLionel Sambuc
132ebfedea0SLionel Sambuc=item B<-certopt option>
133ebfedea0SLionel Sambuc
134ebfedea0SLionel Sambuccustomise the output format used with B<-text>. The B<option> argument can be
135ebfedea0SLionel Sambuca single option or multiple options separated by commas. The B<-certopt> switch
136ebfedea0SLionel Sambucmay be also be used more than once to set multiple options. See the B<TEXT OPTIONS>
137ebfedea0SLionel Sambucsection for more information.
138ebfedea0SLionel Sambuc
139ebfedea0SLionel Sambuc=item B<-noout>
140ebfedea0SLionel Sambuc
141ebfedea0SLionel Sambucthis option prevents output of the encoded version of the request.
142ebfedea0SLionel Sambuc
143ebfedea0SLionel Sambuc=item B<-pubkey>
144ebfedea0SLionel Sambuc
145ebfedea0SLionel Sambucoutputs the the certificate's SubjectPublicKeyInfo block in PEM format.
146ebfedea0SLionel Sambuc
147ebfedea0SLionel Sambuc=item B<-modulus>
148ebfedea0SLionel Sambuc
149ebfedea0SLionel Sambucthis option prints out the value of the modulus of the public key
150ebfedea0SLionel Sambuccontained in the certificate.
151ebfedea0SLionel Sambuc
152ebfedea0SLionel Sambuc=item B<-serial>
153ebfedea0SLionel Sambuc
154ebfedea0SLionel Sambucoutputs the certificate serial number.
155ebfedea0SLionel Sambuc
156ebfedea0SLionel Sambuc=item B<-subject_hash>
157ebfedea0SLionel Sambuc
158ebfedea0SLionel Sambucoutputs the "hash" of the certificate subject name. This is used in OpenSSL to
159ebfedea0SLionel Sambucform an index to allow certificates in a directory to be looked up by subject
160ebfedea0SLionel Sambucname.
161ebfedea0SLionel Sambuc
162ebfedea0SLionel Sambuc=item B<-issuer_hash>
163ebfedea0SLionel Sambuc
164ebfedea0SLionel Sambucoutputs the "hash" of the certificate issuer name.
165ebfedea0SLionel Sambuc
166*0a6a1f1dSLionel Sambuc=item B<-ocspid>
167*0a6a1f1dSLionel Sambuc
168*0a6a1f1dSLionel Sambucoutputs the OCSP hash values for the subject name and public key.
169*0a6a1f1dSLionel Sambuc
170ebfedea0SLionel Sambuc=item B<-hash>
171ebfedea0SLionel Sambuc
172ebfedea0SLionel Sambucsynonym for "-subject_hash" for backward compatibility reasons.
173ebfedea0SLionel Sambuc
174ebfedea0SLionel Sambuc=item B<-subject_hash_old>
175ebfedea0SLionel Sambuc
176ebfedea0SLionel Sambucoutputs the "hash" of the certificate subject name using the older algorithm
177ebfedea0SLionel Sambucas used by OpenSSL versions before 1.0.0.
178ebfedea0SLionel Sambuc
179ebfedea0SLionel Sambuc=item B<-issuer_hash_old>
180ebfedea0SLionel Sambuc
181ebfedea0SLionel Sambucoutputs the "hash" of the certificate issuer name using the older algorithm
182ebfedea0SLionel Sambucas used by OpenSSL versions before 1.0.0.
183ebfedea0SLionel Sambuc
184ebfedea0SLionel Sambuc=item B<-subject>
185ebfedea0SLionel Sambuc
186ebfedea0SLionel Sambucoutputs the subject name.
187ebfedea0SLionel Sambuc
188ebfedea0SLionel Sambuc=item B<-issuer>
189ebfedea0SLionel Sambuc
190ebfedea0SLionel Sambucoutputs the issuer name.
191ebfedea0SLionel Sambuc
192ebfedea0SLionel Sambuc=item B<-nameopt option>
193ebfedea0SLionel Sambuc
194ebfedea0SLionel Sambucoption which determines how the subject or issuer names are displayed. The
195ebfedea0SLionel SambucB<option> argument can be a single option or multiple options separated by
196ebfedea0SLionel Sambuccommas.  Alternatively the B<-nameopt> switch may be used more than once to
197ebfedea0SLionel Sambucset multiple options. See the B<NAME OPTIONS> section for more information.
198ebfedea0SLionel Sambuc
199ebfedea0SLionel Sambuc=item B<-email>
200ebfedea0SLionel Sambuc
201ebfedea0SLionel Sambucoutputs the email address(es) if any.
202ebfedea0SLionel Sambuc
203ebfedea0SLionel Sambuc=item B<-ocsp_uri>
204ebfedea0SLionel Sambuc
205ebfedea0SLionel Sambucoutputs the OCSP responder address(es) if any.
206ebfedea0SLionel Sambuc
207ebfedea0SLionel Sambuc=item B<-startdate>
208ebfedea0SLionel Sambuc
209ebfedea0SLionel Sambucprints out the start date of the certificate, that is the notBefore date.
210ebfedea0SLionel Sambuc
211ebfedea0SLionel Sambuc=item B<-enddate>
212ebfedea0SLionel Sambuc
213ebfedea0SLionel Sambucprints out the expiry date of the certificate, that is the notAfter date.
214ebfedea0SLionel Sambuc
215ebfedea0SLionel Sambuc=item B<-dates>
216ebfedea0SLionel Sambuc
217ebfedea0SLionel Sambucprints out the start and expiry dates of a certificate.
218ebfedea0SLionel Sambuc
219*0a6a1f1dSLionel Sambuc=item B<-checkend arg>
220*0a6a1f1dSLionel Sambuc
221*0a6a1f1dSLionel Sambucchecks if the certificate expires within the next B<arg> seconds and exits
222*0a6a1f1dSLionel Sambucnon-zero if yes it will expire or zero if not.
223*0a6a1f1dSLionel Sambuc
224ebfedea0SLionel Sambuc=item B<-fingerprint>
225ebfedea0SLionel Sambuc
226ebfedea0SLionel Sambucprints out the digest of the DER encoded version of the whole certificate
227ebfedea0SLionel Sambuc(see digest options).
228ebfedea0SLionel Sambuc
229ebfedea0SLionel Sambuc=item B<-C>
230ebfedea0SLionel Sambuc
231ebfedea0SLionel Sambucthis outputs the certificate in the form of a C source file.
232ebfedea0SLionel Sambuc
233ebfedea0SLionel Sambuc=back
234ebfedea0SLionel Sambuc
235ebfedea0SLionel Sambuc=head2 TRUST SETTINGS
236ebfedea0SLionel Sambuc
237ebfedea0SLionel SambucPlease note these options are currently experimental and may well change.
238ebfedea0SLionel Sambuc
239ebfedea0SLionel SambucA B<trusted certificate> is an ordinary certificate which has several
240ebfedea0SLionel Sambucadditional pieces of information attached to it such as the permitted
241ebfedea0SLionel Sambucand prohibited uses of the certificate and an "alias".
242ebfedea0SLionel Sambuc
243ebfedea0SLionel SambucNormally when a certificate is being verified at least one certificate
244ebfedea0SLionel Sambucmust be "trusted". By default a trusted certificate must be stored
245ebfedea0SLionel Sambuclocally and must be a root CA: any certificate chain ending in this CA
246ebfedea0SLionel Sambucis then usable for any purpose.
247ebfedea0SLionel Sambuc
248ebfedea0SLionel SambucTrust settings currently are only used with a root CA. They allow a finer
249ebfedea0SLionel Sambuccontrol over the purposes the root CA can be used for. For example a CA
250ebfedea0SLionel Sambucmay be trusted for SSL client but not SSL server use.
251ebfedea0SLionel Sambuc
252ebfedea0SLionel SambucSee the description of the B<verify> utility for more information on the
253ebfedea0SLionel Sambucmeaning of trust settings.
254ebfedea0SLionel Sambuc
255ebfedea0SLionel SambucFuture versions of OpenSSL will recognize trust settings on any
256ebfedea0SLionel Sambuccertificate: not just root CAs.
257ebfedea0SLionel Sambuc
258ebfedea0SLionel Sambuc
259ebfedea0SLionel Sambuc=over 4
260ebfedea0SLionel Sambuc
261ebfedea0SLionel Sambuc=item B<-trustout>
262ebfedea0SLionel Sambuc
263ebfedea0SLionel Sambucthis causes B<x509> to output a B<trusted> certificate. An ordinary
264ebfedea0SLionel Sambucor trusted certificate can be input but by default an ordinary
265ebfedea0SLionel Sambuccertificate is output and any trust settings are discarded. With the
266ebfedea0SLionel SambucB<-trustout> option a trusted certificate is output. A trusted
267ebfedea0SLionel Sambuccertificate is automatically output if any trust settings are modified.
268ebfedea0SLionel Sambuc
269ebfedea0SLionel Sambuc=item B<-setalias arg>
270ebfedea0SLionel Sambuc
271ebfedea0SLionel Sambucsets the alias of the certificate. This will allow the certificate
272ebfedea0SLionel Sambucto be referred to using a nickname for example "Steve's Certificate".
273ebfedea0SLionel Sambuc
274ebfedea0SLionel Sambuc=item B<-alias>
275ebfedea0SLionel Sambuc
276ebfedea0SLionel Sambucoutputs the certificate alias, if any.
277ebfedea0SLionel Sambuc
278ebfedea0SLionel Sambuc=item B<-clrtrust>
279ebfedea0SLionel Sambuc
280ebfedea0SLionel Sambucclears all the permitted or trusted uses of the certificate.
281ebfedea0SLionel Sambuc
282ebfedea0SLionel Sambuc=item B<-clrreject>
283ebfedea0SLionel Sambuc
284ebfedea0SLionel Sambucclears all the prohibited or rejected uses of the certificate.
285ebfedea0SLionel Sambuc
286ebfedea0SLionel Sambuc=item B<-addtrust arg>
287ebfedea0SLionel Sambuc
288ebfedea0SLionel Sambucadds a trusted certificate use. Any object name can be used here
289ebfedea0SLionel Sambucbut currently only B<clientAuth> (SSL client use), B<serverAuth>
290ebfedea0SLionel Sambuc(SSL server use) and B<emailProtection> (S/MIME email) are used.
291ebfedea0SLionel SambucOther OpenSSL applications may define additional uses.
292ebfedea0SLionel Sambuc
293ebfedea0SLionel Sambuc=item B<-addreject arg>
294ebfedea0SLionel Sambuc
295ebfedea0SLionel Sambucadds a prohibited use. It accepts the same values as the B<-addtrust>
296ebfedea0SLionel Sambucoption.
297ebfedea0SLionel Sambuc
298ebfedea0SLionel Sambuc=item B<-purpose>
299ebfedea0SLionel Sambuc
300ebfedea0SLionel Sambucthis option performs tests on the certificate extensions and outputs
301ebfedea0SLionel Sambucthe results. For a more complete description see the B<CERTIFICATE
302ebfedea0SLionel SambucEXTENSIONS> section.
303ebfedea0SLionel Sambuc
304ebfedea0SLionel Sambuc=back
305ebfedea0SLionel Sambuc
306ebfedea0SLionel Sambuc=head2 SIGNING OPTIONS
307ebfedea0SLionel Sambuc
308ebfedea0SLionel SambucThe B<x509> utility can be used to sign certificates and requests: it
309ebfedea0SLionel Sambuccan thus behave like a "mini CA".
310ebfedea0SLionel Sambuc
311ebfedea0SLionel Sambuc=over 4
312ebfedea0SLionel Sambuc
313ebfedea0SLionel Sambuc=item B<-signkey filename>
314ebfedea0SLionel Sambuc
315ebfedea0SLionel Sambucthis option causes the input file to be self signed using the supplied
316ebfedea0SLionel Sambucprivate key.
317ebfedea0SLionel Sambuc
318ebfedea0SLionel SambucIf the input file is a certificate it sets the issuer name to the
319ebfedea0SLionel Sambucsubject name (i.e.  makes it self signed) changes the public key to the
320ebfedea0SLionel Sambucsupplied value and changes the start and end dates. The start date is
321ebfedea0SLionel Sambucset to the current time and the end date is set to a value determined
322ebfedea0SLionel Sambucby the B<-days> option. Any certificate extensions are retained unless
323ebfedea0SLionel Sambucthe B<-clrext> option is supplied.
324ebfedea0SLionel Sambuc
325ebfedea0SLionel SambucIf the input is a certificate request then a self signed certificate
326ebfedea0SLionel Sambucis created using the supplied private key using the subject name in
327ebfedea0SLionel Sambucthe request.
328ebfedea0SLionel Sambuc
329*0a6a1f1dSLionel Sambuc=item B<-passin arg>
330*0a6a1f1dSLionel Sambuc
331*0a6a1f1dSLionel Sambucthe key password source. For more information about the format of B<arg>
332*0a6a1f1dSLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
333*0a6a1f1dSLionel Sambuc
334ebfedea0SLionel Sambuc=item B<-clrext>
335ebfedea0SLionel Sambuc
336ebfedea0SLionel Sambucdelete any extensions from a certificate. This option is used when a
337ebfedea0SLionel Sambuccertificate is being created from another certificate (for example with
338ebfedea0SLionel Sambucthe B<-signkey> or the B<-CA> options). Normally all extensions are
339ebfedea0SLionel Sambucretained.
340ebfedea0SLionel Sambuc
341ebfedea0SLionel Sambuc=item B<-keyform PEM|DER>
342ebfedea0SLionel Sambuc
343ebfedea0SLionel Sambucspecifies the format (DER or PEM) of the private key file used in the
344ebfedea0SLionel SambucB<-signkey> option.
345ebfedea0SLionel Sambuc
346ebfedea0SLionel Sambuc=item B<-days arg>
347ebfedea0SLionel Sambuc
348ebfedea0SLionel Sambucspecifies the number of days to make a certificate valid for. The default
349ebfedea0SLionel Sambucis 30 days.
350ebfedea0SLionel Sambuc
351ebfedea0SLionel Sambuc=item B<-x509toreq>
352ebfedea0SLionel Sambuc
353ebfedea0SLionel Sambucconverts a certificate into a certificate request. The B<-signkey> option
354ebfedea0SLionel Sambucis used to pass the required private key.
355ebfedea0SLionel Sambuc
356ebfedea0SLionel Sambuc=item B<-req>
357ebfedea0SLionel Sambuc
358ebfedea0SLionel Sambucby default a certificate is expected on input. With this option a
359ebfedea0SLionel Sambuccertificate request is expected instead.
360ebfedea0SLionel Sambuc
361ebfedea0SLionel Sambuc=item B<-set_serial n>
362ebfedea0SLionel Sambuc
363ebfedea0SLionel Sambucspecifies the serial number to use. This option can be used with either
364ebfedea0SLionel Sambucthe B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA>
365ebfedea0SLionel Sambucoption the serial number file (as specified by the B<-CAserial> or
366ebfedea0SLionel SambucB<-CAcreateserial> options) is not used.
367ebfedea0SLionel Sambuc
368ebfedea0SLionel SambucThe serial number can be decimal or hex (if preceded by B<0x>). Negative
369ebfedea0SLionel Sambucserial numbers can also be specified but their use is not recommended.
370ebfedea0SLionel Sambuc
371ebfedea0SLionel Sambuc=item B<-CA filename>
372ebfedea0SLionel Sambuc
373ebfedea0SLionel Sambucspecifies the CA certificate to be used for signing. When this option is
374ebfedea0SLionel Sambucpresent B<x509> behaves like a "mini CA". The input file is signed by this
375ebfedea0SLionel SambucCA using this option: that is its issuer name is set to the subject name
376ebfedea0SLionel Sambucof the CA and it is digitally signed using the CAs private key.
377ebfedea0SLionel Sambuc
378ebfedea0SLionel SambucThis option is normally combined with the B<-req> option. Without the
379ebfedea0SLionel SambucB<-req> option the input is a certificate which must be self signed.
380ebfedea0SLionel Sambuc
381ebfedea0SLionel Sambuc=item B<-CAkey filename>
382ebfedea0SLionel Sambuc
383ebfedea0SLionel Sambucsets the CA private key to sign a certificate with. If this option is
384ebfedea0SLionel Sambucnot specified then it is assumed that the CA private key is present in
385ebfedea0SLionel Sambucthe CA certificate file.
386ebfedea0SLionel Sambuc
387ebfedea0SLionel Sambuc=item B<-CAserial filename>
388ebfedea0SLionel Sambuc
389ebfedea0SLionel Sambucsets the CA serial number file to use.
390ebfedea0SLionel Sambuc
391ebfedea0SLionel SambucWhen the B<-CA> option is used to sign a certificate it uses a serial
392ebfedea0SLionel Sambucnumber specified in a file. This file consist of one line containing
393ebfedea0SLionel Sambucan even number of hex digits with the serial number to use. After each
394ebfedea0SLionel Sambucuse the serial number is incremented and written out to the file again.
395ebfedea0SLionel Sambuc
396ebfedea0SLionel SambucThe default filename consists of the CA certificate file base name with
397ebfedea0SLionel Sambuc".srl" appended. For example if the CA certificate file is called
398ebfedea0SLionel Sambuc"mycacert.pem" it expects to find a serial number file called "mycacert.srl".
399ebfedea0SLionel Sambuc
400ebfedea0SLionel Sambuc=item B<-CAcreateserial>
401ebfedea0SLionel Sambuc
402ebfedea0SLionel Sambucwith this option the CA serial number file is created if it does not exist:
403ebfedea0SLionel Sambucit will contain the serial number "02" and the certificate being signed will
404ebfedea0SLionel Sambuchave the 1 as its serial number. Normally if the B<-CA> option is specified
405ebfedea0SLionel Sambucand the serial number file does not exist it is an error.
406ebfedea0SLionel Sambuc
407ebfedea0SLionel Sambuc=item B<-extfile filename>
408ebfedea0SLionel Sambuc
409ebfedea0SLionel Sambucfile containing certificate extensions to use. If not specified then
410ebfedea0SLionel Sambucno extensions are added to the certificate.
411ebfedea0SLionel Sambuc
412ebfedea0SLionel Sambuc=item B<-extensions section>
413ebfedea0SLionel Sambuc
414ebfedea0SLionel Sambucthe section to add certificate extensions from. If this option is not
415ebfedea0SLionel Sambucspecified then the extensions should either be contained in the unnamed
416ebfedea0SLionel Sambuc(default) section or the default section should contain a variable called
417ebfedea0SLionel Sambuc"extensions" which contains the section to use. See the
418ebfedea0SLionel SambucL<x509v3_config(5)|x509v3_config(5)> manual page for details of the
419ebfedea0SLionel Sambucextension section format.
420ebfedea0SLionel Sambuc
421ebfedea0SLionel Sambuc=back
422ebfedea0SLionel Sambuc
423ebfedea0SLionel Sambuc=head2 NAME OPTIONS
424ebfedea0SLionel Sambuc
425ebfedea0SLionel SambucThe B<nameopt> command line switch determines how the subject and issuer
426ebfedea0SLionel Sambucnames are displayed. If no B<nameopt> switch is present the default "oneline"
427ebfedea0SLionel Sambucformat is used which is compatible with previous versions of OpenSSL.
428ebfedea0SLionel SambucEach option is described in detail below, all options can be preceded by
429ebfedea0SLionel Sambuca B<-> to turn the option off. Only the first four will normally be used.
430ebfedea0SLionel Sambuc
431ebfedea0SLionel Sambuc=over 4
432ebfedea0SLionel Sambuc
433ebfedea0SLionel Sambuc=item B<compat>
434ebfedea0SLionel Sambuc
435ebfedea0SLionel Sambucuse the old format. This is equivalent to specifying no name options at all.
436ebfedea0SLionel Sambuc
437ebfedea0SLionel Sambuc=item B<RFC2253>
438ebfedea0SLionel Sambuc
439ebfedea0SLionel Sambucdisplays names compatible with RFC2253 equivalent to B<esc_2253>, B<esc_ctrl>,
440ebfedea0SLionel SambucB<esc_msb>, B<utf8>, B<dump_nostr>, B<dump_unknown>, B<dump_der>,
441ebfedea0SLionel SambucB<sep_comma_plus>, B<dn_rev> and B<sname>.
442ebfedea0SLionel Sambuc
443ebfedea0SLionel Sambuc=item B<oneline>
444ebfedea0SLionel Sambuc
445ebfedea0SLionel Sambuca oneline format which is more readable than RFC2253. It is equivalent to
446ebfedea0SLionel Sambucspecifying the  B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>, B<dump_nostr>,
447ebfedea0SLionel SambucB<dump_der>, B<use_quote>, B<sep_comma_plus_space>, B<space_eq> and B<sname>
448ebfedea0SLionel Sambucoptions.
449ebfedea0SLionel Sambuc
450ebfedea0SLionel Sambuc=item B<multiline>
451ebfedea0SLionel Sambuc
452ebfedea0SLionel Sambuca multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>,
453ebfedea0SLionel SambucB<space_eq>, B<lname> and B<align>.
454ebfedea0SLionel Sambuc
455ebfedea0SLionel Sambuc=item B<esc_2253>
456ebfedea0SLionel Sambuc
457ebfedea0SLionel Sambucescape the "special" characters required by RFC2253 in a field That is
458ebfedea0SLionel SambucB<,+"E<lt>E<gt>;>. Additionally B<#> is escaped at the beginning of a string
459ebfedea0SLionel Sambucand a space character at the beginning or end of a string.
460ebfedea0SLionel Sambuc
461ebfedea0SLionel Sambuc=item B<esc_ctrl>
462ebfedea0SLionel Sambuc
463ebfedea0SLionel Sambucescape control characters. That is those with ASCII values less than
464ebfedea0SLionel Sambuc0x20 (space) and the delete (0x7f) character. They are escaped using the
465ebfedea0SLionel SambucRFC2253 \XX notation (where XX are two hex digits representing the
466ebfedea0SLionel Sambuccharacter value).
467ebfedea0SLionel Sambuc
468ebfedea0SLionel Sambuc=item B<esc_msb>
469ebfedea0SLionel Sambuc
470ebfedea0SLionel Sambucescape characters with the MSB set, that is with ASCII values larger than
471ebfedea0SLionel Sambuc127.
472ebfedea0SLionel Sambuc
473ebfedea0SLionel Sambuc=item B<use_quote>
474ebfedea0SLionel Sambuc
475ebfedea0SLionel Sambucescapes some characters by surrounding the whole string with B<"> characters,
476ebfedea0SLionel Sambucwithout the option all escaping is done with the B<\> character.
477ebfedea0SLionel Sambuc
478ebfedea0SLionel Sambuc=item B<utf8>
479ebfedea0SLionel Sambuc
480ebfedea0SLionel Sambucconvert all strings to UTF8 format first. This is required by RFC2253. If
481ebfedea0SLionel Sambucyou are lucky enough to have a UTF8 compatible terminal then the use
482ebfedea0SLionel Sambucof this option (and B<not> setting B<esc_msb>) may result in the correct
483ebfedea0SLionel Sambucdisplay of multibyte (international) characters. Is this option is not
484ebfedea0SLionel Sambucpresent then multibyte characters larger than 0xff will be represented
485ebfedea0SLionel Sambucusing the format \UXXXX for 16 bits and \WXXXXXXXX for 32 bits.
486ebfedea0SLionel SambucAlso if this option is off any UTF8Strings will be converted to their
487ebfedea0SLionel Sambuccharacter form first.
488ebfedea0SLionel Sambuc
489*0a6a1f1dSLionel Sambuc=item B<ignore_type>
490ebfedea0SLionel Sambuc
491ebfedea0SLionel Sambucthis option does not attempt to interpret multibyte characters in any
492ebfedea0SLionel Sambucway. That is their content octets are merely dumped as though one octet
493ebfedea0SLionel Sambucrepresents each character. This is useful for diagnostic purposes but
494ebfedea0SLionel Sambucwill result in rather odd looking output.
495ebfedea0SLionel Sambuc
496ebfedea0SLionel Sambuc=item B<show_type>
497ebfedea0SLionel Sambuc
498ebfedea0SLionel Sambucshow the type of the ASN1 character string. The type precedes the
499ebfedea0SLionel Sambucfield contents. For example "BMPSTRING: Hello World".
500ebfedea0SLionel Sambuc
501ebfedea0SLionel Sambuc=item B<dump_der>
502ebfedea0SLionel Sambuc
503ebfedea0SLionel Sambucwhen this option is set any fields that need to be hexdumped will
504ebfedea0SLionel Sambucbe dumped using the DER encoding of the field. Otherwise just the
505ebfedea0SLionel Sambuccontent octets will be displayed. Both options use the RFC2253
506ebfedea0SLionel SambucB<#XXXX...> format.
507ebfedea0SLionel Sambuc
508ebfedea0SLionel Sambuc=item B<dump_nostr>
509ebfedea0SLionel Sambuc
510ebfedea0SLionel Sambucdump non character string types (for example OCTET STRING) if this
511ebfedea0SLionel Sambucoption is not set then non character string types will be displayed
512ebfedea0SLionel Sambucas though each content octet represents a single character.
513ebfedea0SLionel Sambuc
514ebfedea0SLionel Sambuc=item B<dump_all>
515ebfedea0SLionel Sambuc
516ebfedea0SLionel Sambucdump all fields. This option when used with B<dump_der> allows the
517ebfedea0SLionel SambucDER encoding of the structure to be unambiguously determined.
518ebfedea0SLionel Sambuc
519ebfedea0SLionel Sambuc=item B<dump_unknown>
520ebfedea0SLionel Sambuc
521ebfedea0SLionel Sambucdump any field whose OID is not recognised by OpenSSL.
522ebfedea0SLionel Sambuc
523ebfedea0SLionel Sambuc=item B<sep_comma_plus>, B<sep_comma_plus_space>, B<sep_semi_plus_space>,
524ebfedea0SLionel SambucB<sep_multiline>
525ebfedea0SLionel Sambuc
526ebfedea0SLionel Sambucthese options determine the field separators. The first character is
527ebfedea0SLionel Sambucbetween RDNs and the second between multiple AVAs (multiple AVAs are
528ebfedea0SLionel Sambucvery rare and their use is discouraged). The options ending in
529ebfedea0SLionel Sambuc"space" additionally place a space after the separator to make it
530ebfedea0SLionel Sambucmore readable. The B<sep_multiline> uses a linefeed character for
531ebfedea0SLionel Sambucthe RDN separator and a spaced B<+> for the AVA separator. It also
532ebfedea0SLionel Sambucindents the fields by four characters.
533ebfedea0SLionel Sambuc
534ebfedea0SLionel Sambuc=item B<dn_rev>
535ebfedea0SLionel Sambuc
536ebfedea0SLionel Sambucreverse the fields of the DN. This is required by RFC2253. As a side
537ebfedea0SLionel Sambuceffect this also reverses the order of multiple AVAs but this is
538ebfedea0SLionel Sambucpermissible.
539ebfedea0SLionel Sambuc
540ebfedea0SLionel Sambuc=item B<nofname>, B<sname>, B<lname>, B<oid>
541ebfedea0SLionel Sambuc
542ebfedea0SLionel Sambucthese options alter how the field name is displayed. B<nofname> does
543ebfedea0SLionel Sambucnot display the field at all. B<sname> uses the "short name" form
544ebfedea0SLionel Sambuc(CN for commonName for example). B<lname> uses the long form.
545ebfedea0SLionel SambucB<oid> represents the OID in numerical form and is useful for
546ebfedea0SLionel Sambucdiagnostic purpose.
547ebfedea0SLionel Sambuc
548ebfedea0SLionel Sambuc=item B<align>
549ebfedea0SLionel Sambuc
550ebfedea0SLionel Sambucalign field values for a more readable output. Only usable with
551ebfedea0SLionel SambucB<sep_multiline>.
552ebfedea0SLionel Sambuc
553ebfedea0SLionel Sambuc=item B<space_eq>
554ebfedea0SLionel Sambuc
555ebfedea0SLionel Sambucplaces spaces round the B<=> character which follows the field
556ebfedea0SLionel Sambucname.
557ebfedea0SLionel Sambuc
558ebfedea0SLionel Sambuc=back
559ebfedea0SLionel Sambuc
560ebfedea0SLionel Sambuc=head2 TEXT OPTIONS
561ebfedea0SLionel Sambuc
562ebfedea0SLionel SambucAs well as customising the name output format, it is also possible to
563ebfedea0SLionel Sambuccustomise the actual fields printed using the B<certopt> options when
564ebfedea0SLionel Sambucthe B<text> option is present. The default behaviour is to print all fields.
565ebfedea0SLionel Sambuc
566ebfedea0SLionel Sambuc=over 4
567ebfedea0SLionel Sambuc
568ebfedea0SLionel Sambuc=item B<compatible>
569ebfedea0SLionel Sambuc
570ebfedea0SLionel Sambucuse the old format. This is equivalent to specifying no output options at all.
571ebfedea0SLionel Sambuc
572ebfedea0SLionel Sambuc=item B<no_header>
573ebfedea0SLionel Sambuc
574ebfedea0SLionel Sambucdon't print header information: that is the lines saying "Certificate" and "Data".
575ebfedea0SLionel Sambuc
576ebfedea0SLionel Sambuc=item B<no_version>
577ebfedea0SLionel Sambuc
578ebfedea0SLionel Sambucdon't print out the version number.
579ebfedea0SLionel Sambuc
580ebfedea0SLionel Sambuc=item B<no_serial>
581ebfedea0SLionel Sambuc
582ebfedea0SLionel Sambucdon't print out the serial number.
583ebfedea0SLionel Sambuc
584ebfedea0SLionel Sambuc=item B<no_signame>
585ebfedea0SLionel Sambuc
586ebfedea0SLionel Sambucdon't print out the signature algorithm used.
587ebfedea0SLionel Sambuc
588ebfedea0SLionel Sambuc=item B<no_validity>
589ebfedea0SLionel Sambuc
590ebfedea0SLionel Sambucdon't print the validity, that is the B<notBefore> and B<notAfter> fields.
591ebfedea0SLionel Sambuc
592ebfedea0SLionel Sambuc=item B<no_subject>
593ebfedea0SLionel Sambuc
594ebfedea0SLionel Sambucdon't print out the subject name.
595ebfedea0SLionel Sambuc
596ebfedea0SLionel Sambuc=item B<no_issuer>
597ebfedea0SLionel Sambuc
598ebfedea0SLionel Sambucdon't print out the issuer name.
599ebfedea0SLionel Sambuc
600ebfedea0SLionel Sambuc=item B<no_pubkey>
601ebfedea0SLionel Sambuc
602ebfedea0SLionel Sambucdon't print out the public key.
603ebfedea0SLionel Sambuc
604ebfedea0SLionel Sambuc=item B<no_sigdump>
605ebfedea0SLionel Sambuc
606ebfedea0SLionel Sambucdon't give a hexadecimal dump of the certificate signature.
607ebfedea0SLionel Sambuc
608ebfedea0SLionel Sambuc=item B<no_aux>
609ebfedea0SLionel Sambuc
610ebfedea0SLionel Sambucdon't print out certificate trust information.
611ebfedea0SLionel Sambuc
612ebfedea0SLionel Sambuc=item B<no_extensions>
613ebfedea0SLionel Sambuc
614ebfedea0SLionel Sambucdon't print out any X509V3 extensions.
615ebfedea0SLionel Sambuc
616ebfedea0SLionel Sambuc=item B<ext_default>
617ebfedea0SLionel Sambuc
618ebfedea0SLionel Sambucretain default extension behaviour: attempt to print out unsupported certificate extensions.
619ebfedea0SLionel Sambuc
620ebfedea0SLionel Sambuc=item B<ext_error>
621ebfedea0SLionel Sambuc
622ebfedea0SLionel Sambucprint an error message for unsupported certificate extensions.
623ebfedea0SLionel Sambuc
624ebfedea0SLionel Sambuc=item B<ext_parse>
625ebfedea0SLionel Sambuc
626ebfedea0SLionel SambucASN1 parse unsupported extensions.
627ebfedea0SLionel Sambuc
628ebfedea0SLionel Sambuc=item B<ext_dump>
629ebfedea0SLionel Sambuc
630ebfedea0SLionel Sambuchex dump unsupported extensions.
631ebfedea0SLionel Sambuc
632ebfedea0SLionel Sambuc=item B<ca_default>
633ebfedea0SLionel Sambuc
634ebfedea0SLionel Sambucthe value used by the B<ca> utility, equivalent to B<no_issuer>, B<no_pubkey>, B<no_header>,
635ebfedea0SLionel SambucB<no_version>, B<no_sigdump> and B<no_signame>.
636ebfedea0SLionel Sambuc
637ebfedea0SLionel Sambuc=back
638ebfedea0SLionel Sambuc
639ebfedea0SLionel Sambuc=head1 EXAMPLES
640ebfedea0SLionel Sambuc
641ebfedea0SLionel SambucNote: in these examples the '\' means the example should be all on one
642ebfedea0SLionel Sambucline.
643ebfedea0SLionel Sambuc
644ebfedea0SLionel SambucDisplay the contents of a certificate:
645ebfedea0SLionel Sambuc
646ebfedea0SLionel Sambuc openssl x509 -in cert.pem -noout -text
647ebfedea0SLionel Sambuc
648ebfedea0SLionel SambucDisplay the certificate serial number:
649ebfedea0SLionel Sambuc
650ebfedea0SLionel Sambuc openssl x509 -in cert.pem -noout -serial
651ebfedea0SLionel Sambuc
652ebfedea0SLionel SambucDisplay the certificate subject name:
653ebfedea0SLionel Sambuc
654ebfedea0SLionel Sambuc openssl x509 -in cert.pem -noout -subject
655ebfedea0SLionel Sambuc
656ebfedea0SLionel SambucDisplay the certificate subject name in RFC2253 form:
657ebfedea0SLionel Sambuc
658ebfedea0SLionel Sambuc openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
659ebfedea0SLionel Sambuc
660ebfedea0SLionel SambucDisplay the certificate subject name in oneline form on a terminal
661ebfedea0SLionel Sambucsupporting UTF8:
662ebfedea0SLionel Sambuc
663ebfedea0SLionel Sambuc openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb
664ebfedea0SLionel Sambuc
665ebfedea0SLionel SambucDisplay the certificate MD5 fingerprint:
666ebfedea0SLionel Sambuc
667ebfedea0SLionel Sambuc openssl x509 -in cert.pem -noout -fingerprint
668ebfedea0SLionel Sambuc
669ebfedea0SLionel SambucDisplay the certificate SHA1 fingerprint:
670ebfedea0SLionel Sambuc
671ebfedea0SLionel Sambuc openssl x509 -sha1 -in cert.pem -noout -fingerprint
672ebfedea0SLionel Sambuc
673ebfedea0SLionel SambucConvert a certificate from PEM to DER format:
674ebfedea0SLionel Sambuc
675ebfedea0SLionel Sambuc openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
676ebfedea0SLionel Sambuc
677ebfedea0SLionel SambucConvert a certificate to a certificate request:
678ebfedea0SLionel Sambuc
679ebfedea0SLionel Sambuc openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
680ebfedea0SLionel Sambuc
681ebfedea0SLionel SambucConvert a certificate request into a self signed certificate using
682ebfedea0SLionel Sambucextensions for a CA:
683ebfedea0SLionel Sambuc
684ebfedea0SLionel Sambuc openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \
685ebfedea0SLionel Sambuc	-signkey key.pem -out cacert.pem
686ebfedea0SLionel Sambuc
687ebfedea0SLionel SambucSign a certificate request using the CA certificate above and add user
688ebfedea0SLionel Sambuccertificate extensions:
689ebfedea0SLionel Sambuc
690ebfedea0SLionel Sambuc openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \
691ebfedea0SLionel Sambuc	-CA cacert.pem -CAkey key.pem -CAcreateserial
692ebfedea0SLionel Sambuc
693ebfedea0SLionel Sambuc
694ebfedea0SLionel SambucSet a certificate to be trusted for SSL client use and change set its alias to
695ebfedea0SLionel Sambuc"Steve's Class 1 CA"
696ebfedea0SLionel Sambuc
697ebfedea0SLionel Sambuc openssl x509 -in cert.pem -addtrust clientAuth \
698ebfedea0SLionel Sambuc	-setalias "Steve's Class 1 CA" -out trust.pem
699ebfedea0SLionel Sambuc
700ebfedea0SLionel Sambuc=head1 NOTES
701ebfedea0SLionel Sambuc
702ebfedea0SLionel SambucThe PEM format uses the header and footer lines:
703ebfedea0SLionel Sambuc
704ebfedea0SLionel Sambuc -----BEGIN CERTIFICATE-----
705ebfedea0SLionel Sambuc -----END CERTIFICATE-----
706ebfedea0SLionel Sambuc
707ebfedea0SLionel Sambucit will also handle files containing:
708ebfedea0SLionel Sambuc
709ebfedea0SLionel Sambuc -----BEGIN X509 CERTIFICATE-----
710ebfedea0SLionel Sambuc -----END X509 CERTIFICATE-----
711ebfedea0SLionel Sambuc
712ebfedea0SLionel SambucTrusted certificates have the lines
713ebfedea0SLionel Sambuc
714ebfedea0SLionel Sambuc -----BEGIN TRUSTED CERTIFICATE-----
715ebfedea0SLionel Sambuc -----END TRUSTED CERTIFICATE-----
716ebfedea0SLionel Sambuc
717ebfedea0SLionel SambucThe conversion to UTF8 format used with the name options assumes that
718ebfedea0SLionel SambucT61Strings use the ISO8859-1 character set. This is wrong but Netscape
719ebfedea0SLionel Sambucand MSIE do this as do many certificates. So although this is incorrect
720ebfedea0SLionel Sambucit is more likely to display the majority of certificates correctly.
721ebfedea0SLionel Sambuc
722ebfedea0SLionel SambucThe B<-fingerprint> option takes the digest of the DER encoded certificate.
723ebfedea0SLionel SambucThis is commonly called a "fingerprint". Because of the nature of message
724ebfedea0SLionel Sambucdigests the fingerprint of a certificate is unique to that certificate and
725ebfedea0SLionel Sambuctwo certificates with the same fingerprint can be considered to be the same.
726ebfedea0SLionel Sambuc
727ebfedea0SLionel SambucThe Netscape fingerprint uses MD5 whereas MSIE uses SHA1.
728ebfedea0SLionel Sambuc
729ebfedea0SLionel SambucThe B<-email> option searches the subject name and the subject alternative
730ebfedea0SLionel Sambucname extension. Only unique email addresses will be printed out: it will
731ebfedea0SLionel Sambucnot print the same address more than once.
732ebfedea0SLionel Sambuc
733ebfedea0SLionel Sambuc=head1 CERTIFICATE EXTENSIONS
734ebfedea0SLionel Sambuc
735ebfedea0SLionel SambucThe B<-purpose> option checks the certificate extensions and determines
736ebfedea0SLionel Sambucwhat the certificate can be used for. The actual checks done are rather
737ebfedea0SLionel Sambuccomplex and include various hacks and workarounds to handle broken
738ebfedea0SLionel Sambuccertificates and software.
739ebfedea0SLionel Sambuc
740ebfedea0SLionel SambucThe same code is used when verifying untrusted certificates in chains
741ebfedea0SLionel Sambucso this section is useful if a chain is rejected by the verify code.
742ebfedea0SLionel Sambuc
743ebfedea0SLionel SambucThe basicConstraints extension CA flag is used to determine whether the
744ebfedea0SLionel Sambuccertificate can be used as a CA. If the CA flag is true then it is a CA,
745ebfedea0SLionel Sambucif the CA flag is false then it is not a CA. B<All> CAs should have the
746ebfedea0SLionel SambucCA flag set to true.
747ebfedea0SLionel Sambuc
748ebfedea0SLionel SambucIf the basicConstraints extension is absent then the certificate is
749ebfedea0SLionel Sambucconsidered to be a "possible CA" other extensions are checked according
750ebfedea0SLionel Sambucto the intended use of the certificate. A warning is given in this case
751ebfedea0SLionel Sambucbecause the certificate should really not be regarded as a CA: however
752ebfedea0SLionel Sambucit is allowed to be a CA to work around some broken software.
753ebfedea0SLionel Sambuc
754ebfedea0SLionel SambucIf the certificate is a V1 certificate (and thus has no extensions) and
755ebfedea0SLionel Sambucit is self signed it is also assumed to be a CA but a warning is again
756ebfedea0SLionel Sambucgiven: this is to work around the problem of Verisign roots which are V1
757ebfedea0SLionel Sambucself signed certificates.
758ebfedea0SLionel Sambuc
759ebfedea0SLionel SambucIf the keyUsage extension is present then additional restraints are
760ebfedea0SLionel Sambucmade on the uses of the certificate. A CA certificate B<must> have the
761ebfedea0SLionel SambuckeyCertSign bit set if the keyUsage extension is present.
762ebfedea0SLionel Sambuc
763ebfedea0SLionel SambucThe extended key usage extension places additional restrictions on the
764ebfedea0SLionel Sambuccertificate uses. If this extension is present (whether critical or not)
765ebfedea0SLionel Sambucthe key can only be used for the purposes specified.
766ebfedea0SLionel Sambuc
767ebfedea0SLionel SambucA complete description of each test is given below. The comments about
768ebfedea0SLionel SambucbasicConstraints and keyUsage and V1 certificates above apply to B<all>
769ebfedea0SLionel SambucCA certificates.
770ebfedea0SLionel Sambuc
771ebfedea0SLionel Sambuc
772ebfedea0SLionel Sambuc=over 4
773ebfedea0SLionel Sambuc
774ebfedea0SLionel Sambuc=item B<SSL Client>
775ebfedea0SLionel Sambuc
776ebfedea0SLionel SambucThe extended key usage extension must be absent or include the "web client
777ebfedea0SLionel Sambucauthentication" OID.  keyUsage must be absent or it must have the
778ebfedea0SLionel SambucdigitalSignature bit set. Netscape certificate type must be absent or it must
779ebfedea0SLionel Sambuchave the SSL client bit set.
780ebfedea0SLionel Sambuc
781ebfedea0SLionel Sambuc=item B<SSL Client CA>
782ebfedea0SLionel Sambuc
783ebfedea0SLionel SambucThe extended key usage extension must be absent or include the "web client
784ebfedea0SLionel Sambucauthentication" OID. Netscape certificate type must be absent or it must have
785ebfedea0SLionel Sambucthe SSL CA bit set: this is used as a work around if the basicConstraints
786ebfedea0SLionel Sambucextension is absent.
787ebfedea0SLionel Sambuc
788ebfedea0SLionel Sambuc=item B<SSL Server>
789ebfedea0SLionel Sambuc
790ebfedea0SLionel SambucThe extended key usage extension must be absent or include the "web server
791ebfedea0SLionel Sambucauthentication" and/or one of the SGC OIDs.  keyUsage must be absent or it
792ebfedea0SLionel Sambucmust have the digitalSignature, the keyEncipherment set or both bits set.
793ebfedea0SLionel SambucNetscape certificate type must be absent or have the SSL server bit set.
794ebfedea0SLionel Sambuc
795ebfedea0SLionel Sambuc=item B<SSL Server CA>
796ebfedea0SLionel Sambuc
797ebfedea0SLionel SambucThe extended key usage extension must be absent or include the "web server
798ebfedea0SLionel Sambucauthentication" and/or one of the SGC OIDs.  Netscape certificate type must
799ebfedea0SLionel Sambucbe absent or the SSL CA bit must be set: this is used as a work around if the
800ebfedea0SLionel SambucbasicConstraints extension is absent.
801ebfedea0SLionel Sambuc
802ebfedea0SLionel Sambuc=item B<Netscape SSL Server>
803ebfedea0SLionel Sambuc
804ebfedea0SLionel SambucFor Netscape SSL clients to connect to an SSL server it must have the
805ebfedea0SLionel SambuckeyEncipherment bit set if the keyUsage extension is present. This isn't
806ebfedea0SLionel Sambucalways valid because some cipher suites use the key for digital signing.
807ebfedea0SLionel SambucOtherwise it is the same as a normal SSL server.
808ebfedea0SLionel Sambuc
809ebfedea0SLionel Sambuc=item B<Common S/MIME Client Tests>
810ebfedea0SLionel Sambuc
811ebfedea0SLionel SambucThe extended key usage extension must be absent or include the "email
812ebfedea0SLionel Sambucprotection" OID. Netscape certificate type must be absent or should have the
813ebfedea0SLionel SambucS/MIME bit set. If the S/MIME bit is not set in netscape certificate type
814ebfedea0SLionel Sambucthen the SSL client bit is tolerated as an alternative but a warning is shown:
815ebfedea0SLionel Sambucthis is because some Verisign certificates don't set the S/MIME bit.
816ebfedea0SLionel Sambuc
817ebfedea0SLionel Sambuc=item B<S/MIME Signing>
818ebfedea0SLionel Sambuc
819ebfedea0SLionel SambucIn addition to the common S/MIME client tests the digitalSignature bit must
820ebfedea0SLionel Sambucbe set if the keyUsage extension is present.
821ebfedea0SLionel Sambuc
822ebfedea0SLionel Sambuc=item B<S/MIME Encryption>
823ebfedea0SLionel Sambuc
824ebfedea0SLionel SambucIn addition to the common S/MIME tests the keyEncipherment bit must be set
825ebfedea0SLionel Sambucif the keyUsage extension is present.
826ebfedea0SLionel Sambuc
827ebfedea0SLionel Sambuc=item B<S/MIME CA>
828ebfedea0SLionel Sambuc
829ebfedea0SLionel SambucThe extended key usage extension must be absent or include the "email
830ebfedea0SLionel Sambucprotection" OID. Netscape certificate type must be absent or must have the
831ebfedea0SLionel SambucS/MIME CA bit set: this is used as a work around if the basicConstraints
832ebfedea0SLionel Sambucextension is absent.
833ebfedea0SLionel Sambuc
834ebfedea0SLionel Sambuc=item B<CRL Signing>
835ebfedea0SLionel Sambuc
836ebfedea0SLionel SambucThe keyUsage extension must be absent or it must have the CRL signing bit
837ebfedea0SLionel Sambucset.
838ebfedea0SLionel Sambuc
839ebfedea0SLionel Sambuc=item B<CRL Signing CA>
840ebfedea0SLionel Sambuc
841ebfedea0SLionel SambucThe normal CA tests apply. Except in this case the basicConstraints extension
842ebfedea0SLionel Sambucmust be present.
843ebfedea0SLionel Sambuc
844ebfedea0SLionel Sambuc=back
845ebfedea0SLionel Sambuc
846ebfedea0SLionel Sambuc=head1 BUGS
847ebfedea0SLionel Sambuc
848ebfedea0SLionel SambucExtensions in certificates are not transferred to certificate requests and
849ebfedea0SLionel Sambucvice versa.
850ebfedea0SLionel Sambuc
851ebfedea0SLionel SambucIt is possible to produce invalid certificates or requests by specifying the
852ebfedea0SLionel Sambucwrong private key or using inconsistent options in some cases: these should
853ebfedea0SLionel Sambucbe checked.
854ebfedea0SLionel Sambuc
855ebfedea0SLionel SambucThere should be options to explicitly set such things as start and end
856ebfedea0SLionel Sambucdates rather than an offset from the current time.
857ebfedea0SLionel Sambuc
858ebfedea0SLionel SambucThe code to implement the verify behaviour described in the B<TRUST SETTINGS>
859ebfedea0SLionel Sambucis currently being developed. It thus describes the intended behaviour rather
860ebfedea0SLionel Sambucthan the current behaviour. It is hoped that it will represent reality in
861ebfedea0SLionel SambucOpenSSL 0.9.5 and later.
862ebfedea0SLionel Sambuc
863ebfedea0SLionel Sambuc=head1 SEE ALSO
864ebfedea0SLionel Sambuc
865ebfedea0SLionel SambucL<req(1)|req(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
866ebfedea0SLionel SambucL<gendsa(1)|gendsa(1)>, L<verify(1)|verify(1)>,
867ebfedea0SLionel SambucL<x509v3_config(5)|x509v3_config(5)>
868ebfedea0SLionel Sambuc
869ebfedea0SLionel Sambuc=head1 HISTORY
870ebfedea0SLionel Sambuc
871ebfedea0SLionel SambucBefore OpenSSL 0.9.8, the default digest for RSA keys was MD5.
872ebfedea0SLionel Sambuc
873ebfedea0SLionel SambucThe hash algorithm used in the B<-subject_hash> and B<-issuer_hash> options
874ebfedea0SLionel Sambucbefore OpenSSL 1.0.0 was based on the deprecated MD5 algorithm and the encoding
875ebfedea0SLionel Sambucof the distinguished name. In OpenSSL 1.0.0 and later it is based on a
876ebfedea0SLionel Sambuccanonical version of the DN using SHA1. This means that any directories using
877ebfedea0SLionel Sambucthe old form must have their links rebuilt using B<c_rehash> or similar.
878ebfedea0SLionel Sambuc
879ebfedea0SLionel Sambuc=cut
880