0dcad3fd9b1809c8bc75db02e98439dbf3578462
[openssl.git] / doc / man1 / openssl-x509.pod.in
1 =pod
2 {- OpenSSL::safe::output_do_not_edit_headers(); -}
3
4 =head1 NAME
5
6 openssl-x509 - Certificate display and signing command
7
8 =head1 SYNOPSIS
9
10 B<openssl> B<x509>
11 [B<-help>]
12 [B<-in> I<filename>|I<uri>]
13 [B<-passin> I<arg>]
14 [B<-new>]
15 [B<-x509toreq>]
16 [B<-req>]
17 [B<-copy_extensions> I<arg>]
18 [B<-inform> B<DER>|B<PEM>]
19 [B<-vfyopt> I<nm>:I<v>]
20 [B<-key> I<filename>|I<uri>]
21 [B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
22 [B<-signkey> I<filename>|I<uri>]
23 [B<-out> I<filename>]
24 [B<-outform> B<DER>|B<PEM>]
25 [B<-nocert>]
26 [B<-noout>]
27 [B<-text>]
28 [B<-certopt> I<option>]
29 [B<-fingerprint>]
30 [B<-alias>]
31 [B<-serial>]
32 [B<-startdate>]
33 [B<-enddate>]
34 [B<-dates>]
35 [B<-subject>]
36 [B<-issuer>]
37 {- $OpenSSL::safe::opt_name_synopsis -}
38 [B<-email>]
39 [B<-hash>]
40 [B<-subject_hash>]
41 [B<-subject_hash_old>]
42 [B<-issuer_hash>]
43 [B<-issuer_hash_old>]
44 [B<-ext> I<extensions>]
45 [B<-ocspid>]
46 [B<-ocsp_uri>]
47 [B<-purpose>]
48 [B<-pubkey>]
49 [B<-modulus>]
50 [B<-checkend> I<num>]
51 [B<-checkhost> I<host>]
52 [B<-checkemail> I<host>]
53 [B<-checkip> I<ipaddr>]
54 [B<-set_serial> I<n>]
55 [B<-next_serial>]
56 [B<-days> I<arg>]
57 [B<-preserve_dates>]
58 [B<-subj> I<arg>]
59 [B<-force_pubkey> I<filename>]
60 [B<-clrext>]
61 [B<-extfile> I<filename>]
62 [B<-extensions> I<section>]
63 [B<-sigopt> I<nm>:I<v>]
64 [B<-badsig>]
65 [B<-I<digest>>]
66 [B<-CA> I<filename>|I<uri>]
67 [B<-CAform> B<DER>|B<PEM>|B<P12>]
68 [B<-CAkey> I<filename>|I<uri>]
69 [B<-CAkeyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
70 [B<-CAserial> I<filename>]
71 [B<-CAcreateserial>]
72 [B<-trustout>]
73 [B<-setalias> I<arg>]
74 [B<-clrtrust>]
75 [B<-addtrust> I<arg>]
76 [B<-clrreject>]
77 [B<-addreject> I<arg>]
78 {- $OpenSSL::safe::opt_r_synopsis -}
79 {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
80
81 =for openssl ifdef engine subject_hash_old issuer_hash_old
82
83 =head1 DESCRIPTION
84
85 This command is a multi-purposes certificate handling command.
86 It can be used to print certificate information,
87 convert certificates to various forms, edit certificate trust settings,
88 generate certificates from scratch or from certificating requests
89 and then self-signing them or signing them like a "micro CA".
90
91 Since there are a large number of options they will split up into
92 various sections.
93
94 =head1 OPTIONS
95
96 =head2 Input, Output, and General Purpose Options
97
98 =over 4
99
100 =item B<-help>
101
102 Print out a usage message.
103
104 =item B<-in> I<filename>|I<uri>
105
106 If the B<-req> option is not used this specifies the input
107 to read a certificate from or standard input if this option is not specified.
108 With the B<-req> option this specifies a certificate request file.
109
110 =item B<-passin> I<arg>
111
112 The key and certificate file password source.
113 For more information about the format of I<arg>
114 see L<openssl-passphrase-options(1)>.
115
116 =item B<-new>
117
118 Generate a certificate from scratch, not using an input certificate
119 or certificate request. So the B<-in> option must not be used in this case.
120 Instead, the B<-subj> option needs to be given.
121 The public key to include can be given with the B<-force_pubkey> option
122 and defaults to the key given with the B<-key> option,
123 which implies self-signature.
124
125 =item B<-x509toreq>
126
127 Output a PKCS#10 certificate request (rather than a certificate).
128 The B<-key> option must be used to provide the private key for self-signing;
129 the corresponding public key is placed in the subjectPKInfo field.
130
131 X.509 extensions included in a certificate input are not copied by default.
132 X.509 extensions to be added can be specified using the B<-extfile> option.
133
134 =item B<-req>
135
136 By default a certificate is expected on input.
137 With this option a PKCS#10 certificate request is expected instead,
138 which must be correctly self-signed.
139
140 X.509 extensions included in the request are not copied by default.
141 X.509 extensions to be added can be specified using the B<-extfile> option.
142
143 =item B<-copy_extensions> I<arg>
144
145 Determines how to handle X.509 extensions
146 when converting from a certificate to a request using the B<-x509toreq> option
147 or converting from a request to a certificate using the B<-req> option.
148 If I<arg> is B<none> or this option is not present then extensions are ignored.
149 If I<arg> is B<copy> or B<copyall> then all extensions are copied,
150 except that subject identifier and authority key identifier extensions
151 are not taken over when producing a certificate request.
152
153 The B<-ext> option can be used to further restrict which extensions to copy.
154
155 =item B<-inform> B<DER>|B<PEM>
156
157 The input file format; unspecified by default.
158 See L<openssl-format-options(1)> for details.
159
160 =item B<-vfyopt> I<nm>:I<v>
161
162 Pass options to the signature algorithm during verify operations.
163 Names and values of these options are algorithm-specific.
164
165 =item B<-key> I<filename>|I<uri>
166
167 This option causes the new certificate or certificate request
168 to be self-signed using the supplied private key.
169 This cannot be used in conjunction with the B<-CA> option.
170
171 It sets the issuer name to the subject name (i.e., makes it self-issued)
172 and changes the public key to the supplied value (unless overridden
173 by B<-force_pubkey>).
174 Unless the B<-preserve_dates> option is supplied,
175 it sets the validity start date to the current time
176 and the end date to a value determined by the B<-days> option.
177
178 =item B<-signkey> I<filename>|I<uri>
179
180 This option is an alias of B<-key>.
181
182 =item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
183
184 The key input format; unspecified by default.
185 See L<openssl-format-options(1)> for details.
186
187 =item B<-out> I<filename>
188
189 This specifies the output filename to write to or standard output by default.
190
191 =item B<-outform> B<DER>|B<PEM>
192
193 The output format; the default is B<PEM>.
194 See L<openssl-format-options(1)> for details.
195
196 =item B<-nocert>
197
198 Do not output a certificate (except for printing as requested by below options).
199
200 =item B<-noout>
201
202 This option prevents output except for printing as requested by below options.
203
204 =back
205
206 =head2 Certificate Printing Options
207
208 Note: the B<-alias> and B<-purpose> options are also printing options
209 but are described in the L</Trust Settings> section.
210
211 =over 4
212
213 =item B<-text>
214
215 Prints out the certificate in text form. Full details are printed including the
216 public key, signature algorithms, issuer and subject names, serial number
217 any extensions present and any trust settings.
218
219 =item B<-certopt> I<option>
220
221 Customise the print format used with B<-text>. The I<option> argument
222 can be a single option or multiple options separated by commas.
223 The B<-certopt> switch may be also be used more than once to set multiple
224 options. See the L</Text Printing Flags> section for more information.
225
226 =item B<-fingerprint>
227
228 Calculates and prints the digest of the DER encoded version of the entire
229 certificate (see digest options).
230 This is commonly called a "fingerprint". Because of the nature of message
231 digests, the fingerprint of a certificate is unique to that certificate and
232 two certificates with the same fingerprint can be considered to be the same.
233
234 =item B<-alias>
235
236 Prints the certificate "alias" (nickname), if any.
237
238 =item B<-serial>
239
240 Prints the certificate serial number.
241
242 =item B<-startdate>
243
244 Prints out the start date of the certificate, that is the notBefore date.
245
246 =item B<-enddate>
247
248 Prints out the expiry date of the certificate, that is the notAfter date.
249
250 =item B<-dates>
251
252 Prints out the start and expiry dates of a certificate.
253
254 =item B<-subject>
255
256 Prints the subject name.
257
258 =item B<-issuer>
259
260 Prints the issuer name.
261
262 {- $OpenSSL::safe::opt_name_item -}
263
264 =item B<-email>
265
266 Prints the email address(es) if any.
267
268 =item B<-hash>
269
270 Synonym for "-subject_hash" for backward compatibility reasons.
271
272 =item B<-subject_hash>
273
274 Prints the "hash" of the certificate subject name. This is used in OpenSSL to
275 form an index to allow certificates in a directory to be looked up by subject
276 name.
277
278 =item B<-subject_hash_old>
279
280 Prints the "hash" of the certificate subject name using the older algorithm
281 as used by OpenSSL before version 1.0.0.
282
283 =item B<-issuer_hash>
284
285 Prints the "hash" of the certificate issuer name.
286
287 =item B<-issuer_hash_old>
288
289 Prints the "hash" of the certificate issuer name using the older algorithm
290 as used by OpenSSL before version 1.0.0.
291
292 =item B<-ext> I<extensions>
293
294 Prints out the certificate extensions in text form.
295 Can also be used to restrict which extensions to copy.
296 Extensions are specified
297 with a comma separated string, e.g., "subjectAltName,subjectKeyIdentifier".
298 See the L<x509v3_config(5)> manual page for the extension names.
299
300 =item B<-ocspid>
301
302 Prints the OCSP hash values for the subject name and public key.
303
304 =item B<-ocsp_uri>
305
306 Prints the OCSP responder address(es) if any.
307
308 =item B<-purpose>
309
310 This option performs tests on the certificate extensions and prints
311 the results. For a more complete description see the
312 L</CERTIFICATE EXTENSIONS> section.
313
314 =item B<-pubkey>
315
316 Prints the certificate's SubjectPublicKeyInfo block in PEM format.
317
318 =item B<-modulus>
319
320 This option prints out the value of the modulus of the public key
321 contained in the certificate.
322
323 =back
324
325 =head2 Certificate Checking Options
326
327 =over 4
328
329 =item B<-checkend> I<arg>
330
331 Checks if the certificate expires within the next I<arg> seconds and exits
332 nonzero if yes it will expire or zero if not.
333
334 =item B<-checkhost> I<host>
335
336 Check that the certificate matches the specified host.
337
338 =item B<-checkemail> I<email>
339
340 Check that the certificate matches the specified email address.
341
342 =item B<-checkip> I<ipaddr>
343
344 Check that the certificate matches the specified IP address.
345
346 =back
347
348 =head2 Certificate Output Options
349
350 =over 4
351
352 =item B<-set_serial> I<n>
353
354 Specifies the serial number to use. This option can be used with either
355 the B<-key> or B<-CA> options. If used in conjunction with the B<-CA> option
356 the serial number file (as specified by the B<-CAserial> option) is not used.
357
358 The serial number can be decimal or hex (if preceded by C<0x>).
359
360 =item B<-next_serial>
361
362 Set the serial to be one more than the number in the certificate.
363
364 =item B<-days> I<arg>
365
366 Specifies the number of days until a newly generated certificate expires.
367 The default is 30.
368 Cannot be used together with the B<-preserve_dates> option.
369
370 =item B<-preserve_dates>
371
372 When signing a certificate, preserve "notBefore" and "notAfter" dates of any
373 input certificate instead of adjusting them to current time and duration.
374 Cannot be used together with the B<-days> option.
375
376 =item B<-subj> I<arg>
377
378 When a certificate is created set its subject name to the given value.
379 When the certificate is self-signed the issuer name is set to the same value.
380
381 The arg must be formatted as C</type0=value0/type1=value1/type2=...>.
382 Special characters may be escaped by C<\> (backslash), whitespace is retained.
383 Empty values are permitted, but the corresponding type will not be included
384 in the certificate.
385 Giving a single C</> will lead to an empty sequence of RDNs (a NULL-DN).
386 Multi-valued RDNs can be formed by placing a C<+> character instead of a C</>
387 between the AttributeValueAssertions (AVAs) that specify the members of the set.
388 Example:
389
390 C</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe>
391
392 This option can be used in conjunction with the B<-force_pubkey> option
393 to create a certificate even without providing an input certificate
394 or certificate request.
395
396 =item B<-force_pubkey> I<filename>
397
398 When a certificate is created set its public key to the key in I<filename>
399 instead of the key contained in the input or given with the B<-key> option.
400
401 This option is useful for creating self-issued certificates that are not
402 self-signed, for instance when the key cannot be used for signing, such as DH.
403 It can also be used in conjunction with b<-new> and B<-subj> to directly
404 generate a certificate containing any desired public key.
405
406 =item B<-clrext>
407
408 When transforming a certificate to a new certificate
409 by default all certificate extensions are retained.
410
411 When transforming a certificate or certificate request,
412 the B<-clrext> option prevents taking over any extensions from the source.
413 In any case, when producing a certificate request,
414 neither subject identifier nor authority key identifier extensions are included.
415
416 =item B<-extfile> I<filename>
417
418 Configuration file containing certificate and request X.509 extensions to add.
419
420 =item B<-extensions> I<section>
421
422 The section in the extfile to add X.509 extensions from.
423 If this option is not
424 specified then the extensions should either be contained in the unnamed
425 (default) section or the default section should contain a variable called
426 "extensions" which contains the section to use.
427 See the L<x509v3_config(5)> manual page for details of the
428 extension section format.
429
430 =item B<-sigopt> I<nm>:I<v>
431
432 Pass options to the signature algorithm during sign operations.
433 This option may be given multiple times.
434 Names and values provided using this option are algorithm-specific.
435
436 =item B<-badsig>
437
438 Corrupt the signature before writing it; this can be useful
439 for testing.
440
441 =item B<-I<digest>>
442
443 The digest to use.
444 This affects any signing or printing option that uses a message
445 digest, such as the B<-fingerprint>, B<-key> and B<-CA> options.
446 Any digest supported by the L<openssl-dgst(1)> command can be used.
447 If not specified then SHA1 is used with B<-fingerprint> or
448 the default digest for the signing algorithm is used, typically SHA256.
449
450 =back
451
452 =head2 Micro-CA Options
453
454 =over 4
455
456 =item B<-CA> I<filename>|I<uri>
457
458 Specifies the "CA" certificate to be used for signing.
459 When present, this behaves like a "micro CA" as follows:
460 The subject name of the "CA" certificate is placed as issuer name in the new
461 certificate, which is then signed using the "CA" key given as detailed below.
462
463 This option cannot be used in conjunction with the B<-key> option.
464 This option is normally combined with the B<-req> option referencing a CSR.
465 Without the B<-req> option the input must be a self-signed certificate
466 unless the B<-new> option is given, which generates a certificate from scratch.
467
468 =item B<-CAform> B<DER>|B<PEM>|B<P12>,
469
470 The format for the CA certificate; unspecifed by default.
471 See L<openssl-format-options(1)> for details.
472
473 =item B<-CAkey> I<filename>|I<uri>
474
475 Sets the CA private key to sign a certificate with.
476 The private key must match the public key of the certificate given with B<-CA>.
477 If this option is not provided then the key must be present in the B<-CA> input.
478
479 =item B<-CAkeyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
480
481 The format for the CA key; unspecified by default.
482 See L<openssl-format-options(1)> for details.
483
484 =item B<-CAserial> I<filename>
485
486 Sets the CA serial number file to use.
487
488 When the B<-CA> option is used to sign a certificate it uses a serial
489 number specified in a file. This file consists of one line containing
490 an even number of hex digits with the serial number to use. After each
491 use the serial number is incremented and written out to the file again.
492
493 The default filename consists of the CA certificate file base name with
494 F<.srl> appended. For example if the CA certificate file is called
495 F<mycacert.pem> it expects to find a serial number file called
496 F<mycacert.srl>.
497
498 =item B<-CAcreateserial>
499
500 With this option the CA serial number file is created if it does not exist:
501 it will contain the serial number "02" and the certificate being signed will
502 have the 1 as its serial number. If the B<-CA> option is specified
503 and the serial number file does not exist a random number is generated;
504 this is the recommended practice.
505
506 =back
507
508 =head2 Trust Settings
509
510 A B<trusted certificate> is an ordinary certificate which has several
511 additional pieces of information attached to it such as the permitted
512 and prohibited uses of the certificate and possibly an "alias" (nickname).
513
514 Normally when a certificate is being verified at least one certificate
515 must be "trusted". By default a trusted certificate must be stored
516 locally and must be a root CA: any certificate chain ending in this CA
517 is then usable for any purpose.
518
519 Trust settings currently are only used with a root CA.
520 They allow a finer control over the purposes the root CA can be used for.
521 For example, a CA may be trusted for SSL client but not SSL server use.
522
523 See the description in L<openssl-verify(1)> for more information
524 on the meaning of trust settings.
525
526 Future versions of OpenSSL will recognize trust settings on any
527 certificate: not just root CAs.
528
529 =over 4
530
531 =item B<-trustout>
532
533 Mark any certificate PEM output as <trusted> certificate rather than ordinary.
534 An ordinary or trusted certificate can be input but by default an ordinary
535 certificate is output and any trust settings are discarded.
536 With the B<-trustout> option a trusted certificate is output. A trusted
537 certificate is automatically output if any trust settings are modified.
538
539 =item B<-setalias> I<arg>
540
541 Sets the "alias" of the certificate. This will allow the certificate
542 to be referred to using a nickname for example "Steve's Certificate".
543
544 =item B<-clrtrust>
545
546 Clears all the permitted or trusted uses of the certificate.
547
548 =item B<-addtrust> I<arg>
549
550 Adds a trusted certificate use.
551 Any object name can be used here but currently only B<clientAuth> (SSL client
552 use), B<serverAuth> (SSL server use), B<emailProtection> (S/MIME email)
553 and B<anyExtendedKeyUsage> are used.
554 As of OpenSSL 1.1.0, the last of these blocks all purposes when rejected or
555 enables all purposes when trusted.
556 Other OpenSSL applications may define additional uses.
557
558 =item B<-clrreject>
559
560 Clears all the prohibited or rejected uses of the certificate.
561
562 =item B<-addreject> I<arg>
563
564 Adds a prohibited use.
565 It accepts the same values as the B<-addtrust> option.
566
567 =back
568
569 =head2 Generic options
570
571 =over 4
572
573 {- $OpenSSL::safe::opt_r_item -}
574
575 {- $OpenSSL::safe::opt_engine_item -}
576
577 {- $OpenSSL::safe::opt_provider_item -}
578
579 =back
580
581 =head2 Text Printing Flags
582
583 As well as customising the name printing format, it is also possible to
584 customise the actual fields printed using the B<certopt> option when
585 the B<text> option is present. The default behaviour is to print all fields.
586
587 =over 4
588
589 =item B<compatible>
590
591 Use the old format. This is equivalent to specifying no printing options at all.
592
593 =item B<no_header>
594
595 Don't print header information: that is the lines saying "Certificate"
596 and "Data".
597
598 =item B<no_version>
599
600 Don't print out the version number.
601
602 =item B<no_serial>
603
604 Don't print out the serial number.
605
606 =item B<no_signame>
607
608 Don't print out the signature algorithm used.
609
610 =item B<no_validity>
611
612 Don't print the validity, that is the B<notBefore> and B<notAfter> fields.
613
614 =item B<no_subject>
615
616 Don't print out the subject name.
617
618 =item B<no_issuer>
619
620 Don't print out the issuer name.
621
622 =item B<no_pubkey>
623
624 Don't print out the public key.
625
626 =item B<no_sigdump>
627
628 Don't give a hexadecimal dump of the certificate signature.
629
630 =item B<no_aux>
631
632 Don't print out certificate trust information.
633
634 =item B<no_extensions>
635
636 Don't print out any X509V3 extensions.
637
638 =item B<ext_default>
639
640 Retain default extension behaviour: attempt to print out unsupported
641 certificate extensions.
642
643 =item B<ext_error>
644
645 Print an error message for unsupported certificate extensions.
646
647 =item B<ext_parse>
648
649 ASN1 parse unsupported extensions.
650
651 =item B<ext_dump>
652
653 Hex dump unsupported extensions.
654
655 =item B<ca_default>
656
657 The value used by L<openssl-ca(1)>, equivalent to B<no_issuer>, B<no_pubkey>,
658 B<no_header>, and B<no_version>.
659
660 =back
661
662 =head1 EXAMPLES
663
664 Note: in these examples the '\' means the example should be all on one
665 line.
666
667 Print the contents of a certificate:
668
669  openssl x509 -in cert.pem -noout -text
670
671 Print the "Subject Alternative Name" extension of a certificate:
672
673  openssl x509 -in cert.pem -noout -ext subjectAltName
674
675 Print more extensions of a certificate:
676
677  openssl x509 -in cert.pem -noout -ext subjectAltName,nsCertType
678
679 Print the certificate serial number:
680
681  openssl x509 -in cert.pem -noout -serial
682
683 Print the certificate subject name:
684
685  openssl x509 -in cert.pem -noout -subject
686
687 Print the certificate subject name in RFC2253 form:
688
689  openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
690
691 Print the certificate subject name in oneline form on a terminal
692 supporting UTF8:
693
694  openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb
695
696 Print the certificate SHA1 fingerprint:
697
698  openssl x509 -sha1 -in cert.pem -noout -fingerprint
699
700 Convert a certificate from PEM to DER format:
701
702  openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
703
704 Convert a certificate to a certificate request:
705
706  openssl x509 -x509toreq -in cert.pem -out req.pem -key key.pem
707
708 Convert a certificate request into a self-signed certificate using
709 extensions for a CA:
710
711  openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \
712         -key key.pem -out cacert.pem
713
714 Sign a certificate request using the CA certificate above and add user
715 certificate extensions:
716
717  openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \
718         -CA cacert.pem -CAkey key.pem -CAcreateserial
719
720 Set a certificate to be trusted for SSL client use and change set its alias to
721 "Steve's Class 1 CA"
722
723  openssl x509 -in cert.pem -addtrust clientAuth \
724         -setalias "Steve's Class 1 CA" -out trust.pem
725
726 =head1 NOTES
727
728 The conversion to UTF8 format used with the name options assumes that
729 T61Strings use the ISO8859-1 character set. This is wrong but Netscape
730 and MSIE do this as do many certificates. So although this is incorrect
731 it is more likely to print the majority of certificates correctly.
732
733 The B<-email> option searches the subject name and the subject alternative
734 name extension. Only unique email addresses will be printed out: it will
735 not print the same address more than once.
736
737 =head1 CERTIFICATE EXTENSIONS
738
739 The B<-purpose> option checks the certificate extensions and determines
740 what the certificate can be used for. The actual checks done are rather
741 complex and include various hacks and workarounds to handle broken
742 certificates and software.
743
744 The same code is used when verifying untrusted certificates in chains
745 so this section is useful if a chain is rejected by the verify code.
746
747 The basicConstraints extension CA flag is used to determine whether the
748 certificate can be used as a CA. If the CA flag is true then it is a CA,
749 if the CA flag is false then it is not a CA. B<All> CAs should have the
750 CA flag set to true.
751
752 If the basicConstraints extension is absent then the certificate is
753 considered to be a "possible CA" other extensions are checked according
754 to the intended use of the certificate. A warning is given in this case
755 because the certificate should really not be regarded as a CA: however
756 it is allowed to be a CA to work around some broken software.
757
758 If the certificate is a V1 certificate (and thus has no extensions) and
759 it is self-signed it is also assumed to be a CA but a warning is again
760 given: this is to work around the problem of Verisign roots which are V1
761 self-signed certificates.
762
763 If the keyUsage extension is present then additional restraints are
764 made on the uses of the certificate. A CA certificate B<must> have the
765 keyCertSign bit set if the keyUsage extension is present.
766
767 The extended key usage extension places additional restrictions on the
768 certificate uses. If this extension is present (whether critical or not)
769 the key can only be used for the purposes specified.
770
771 A complete description of each test is given below. The comments about
772 basicConstraints and keyUsage and V1 certificates above apply to B<all>
773 CA certificates.
774
775
776 =over 4
777
778 =item B<SSL Client>
779
780 The extended key usage extension must be absent or include the "web client
781 authentication" OID.  keyUsage must be absent or it must have the
782 digitalSignature bit set. Netscape certificate type must be absent or it must
783 have the SSL client bit set.
784
785 =item B<SSL Client CA>
786
787 The extended key usage extension must be absent or include the "web client
788 authentication" OID. Netscape certificate type must be absent or it must have
789 the SSL CA bit set: this is used as a work around if the basicConstraints
790 extension is absent.
791
792 =item B<SSL Server>
793
794 The extended key usage extension must be absent or include the "web server
795 authentication" and/or one of the SGC OIDs.  keyUsage must be absent or it
796 must have the digitalSignature, the keyEncipherment set or both bits set.
797 Netscape certificate type must be absent or have the SSL server bit set.
798
799 =item B<SSL Server CA>
800
801 The extended key usage extension must be absent or include the "web server
802 authentication" and/or one of the SGC OIDs.  Netscape certificate type must
803 be absent or the SSL CA bit must be set: this is used as a work around if the
804 basicConstraints extension is absent.
805
806 =item B<Netscape SSL Server>
807
808 For Netscape SSL clients to connect to an SSL server it must have the
809 keyEncipherment bit set if the keyUsage extension is present. This isn't
810 always valid because some cipher suites use the key for digital signing.
811 Otherwise it is the same as a normal SSL server.
812
813 =item B<Common S/MIME Client Tests>
814
815 The extended key usage extension must be absent or include the "email
816 protection" OID. Netscape certificate type must be absent or should have the
817 S/MIME bit set. If the S/MIME bit is not set in Netscape certificate type
818 then the SSL client bit is tolerated as an alternative but a warning is shown:
819 this is because some Verisign certificates don't set the S/MIME bit.
820
821 =item B<S/MIME Signing>
822
823 In addition to the common S/MIME client tests the digitalSignature bit or
824 the nonRepudiation bit must be set if the keyUsage extension is present.
825
826 =item B<S/MIME Encryption>
827
828 In addition to the common S/MIME tests the keyEncipherment bit must be set
829 if the keyUsage extension is present.
830
831 =item B<S/MIME CA>
832
833 The extended key usage extension must be absent or include the "email
834 protection" OID. Netscape certificate type must be absent or must have the
835 S/MIME CA bit set: this is used as a work around if the basicConstraints
836 extension is absent.
837
838 =item B<CRL Signing>
839
840 The keyUsage extension must be absent or it must have the CRL signing bit
841 set.
842
843 =item B<CRL Signing CA>
844
845 The normal CA tests apply. Except in this case the basicConstraints extension
846 must be present.
847
848 =back
849
850 =head1 BUGS
851
852 It is possible to produce invalid certificates or requests by specifying the
853 wrong private key, using unsuitable X.509 extensions,
854 or using inconsistent options in some cases: these should be checked.
855
856 There should be options to explicitly set such things as start and end
857 dates rather than an offset from the current time.
858
859 =head1 SEE ALSO
860
861 L<openssl(1)>,
862 L<openssl-req(1)>,
863 L<openssl-ca(1)>,
864 L<openssl-genrsa(1)>,
865 L<openssl-gendsa(1)>,
866 L<openssl-verify(1)>,
867 L<x509v3_config(5)>
868
869 =head1 HISTORY
870
871 The hash algorithm used in the B<-subject_hash> and B<-issuer_hash> options
872 before OpenSSL 1.0.0 was based on the deprecated MD5 algorithm and the encoding
873 of the distinguished name. In OpenSSL 1.0.0 and later it is based on a canonical
874 version of the DN using SHA1. This means that any directories using the old
875 form must have their links rebuilt using L<openssl-rehash(1)> or similar.
876
877 The B<-signkey> option has been renamed to B<-key> in OpenSSL 3.0,
878 keeping the old name as an alias.
879
880 The B<-engine> option was deprecated in OpenSSL 3.0.
881
882 The B<-C> option was removed in OpenSSL 3.0.
883
884 =head1 COPYRIGHT
885
886 Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
887
888 Licensed under the Apache License 2.0 (the "License").  You may not use
889 this file except in compliance with the License.  You can obtain a copy
890 in the file LICENSE in the source distribution or at
891 L<https://www.openssl.org/source/license.html>.
892
893 =cut