openssl-prebuild/linux_amd64/ssl/share/man/man1/openssl-ca.1

838 lines
34 KiB
Groff
Raw Permalink Normal View History

2020-03-02 11:50:34 -05:00
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "OPENSSL-CA 1"
.TH OPENSSL-CA 1 "2020-03-02" "3.0.0-dev" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
openssl\-ca \- sample minimal CA application
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBopenssl\fR \fBca\fR
[\fB\-help\fR]
[\fB\-verbose\fR]
[\fB\-config\fR \fIfilename\fR]
[\fB\-name\fR \fIsection\fR]
[\fB\-gencrl\fR]
[\fB\-revoke\fR \fIfile\fR]
[\fB\-valid\fR \fIfile\fR]
[\fB\-status\fR \fIserial\fR]
[\fB\-updatedb\fR]
[\fB\-crl_reason\fR \fIreason\fR]
[\fB\-crl_hold\fR \fIinstruction\fR]
[\fB\-crl_compromise\fR \fItime\fR]
[\fB\-crl_CA_compromise\fR \fItime\fR]
[\fB\-crldays\fR \fIdays\fR]
[\fB\-crlhours\fR \fIhours\fR]
[\fB\-crlsec\fR \fIseconds\fR]
[\fB\-crlexts\fR \fIsection\fR]
[\fB\-startdate\fR \fIdate\fR]
[\fB\-enddate\fR \fIdate\fR]
[\fB\-days\fR \fIarg\fR]
[\fB\-md\fR \fIarg\fR]
[\fB\-policy\fR \fIarg\fR]
[\fB\-keyfile\fR \fIarg\fR]
[\fB\-keyform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR]
[\fB\-key\fR \fIarg\fR]
[\fB\-passin\fR \fIarg\fR]
[\fB\-cert\fR \fIfile\fR]
[\fB\-selfsign\fR]
[\fB\-in\fR \fIfile\fR]
[\fB\-out\fR \fIfile\fR]
[\fB\-notext\fR]
[\fB\-outdir\fR \fIdir\fR]
[\fB\-infiles\fR]
[\fB\-spkac\fR \fIfile\fR]
[\fB\-ss_cert\fR \fIfile\fR]
[\fB\-preserveDN\fR]
[\fB\-noemailDN\fR]
[\fB\-batch\fR]
[\fB\-msie_hack\fR]
[\fB\-extensions\fR \fIsection\fR]
[\fB\-extfile\fR \fIsection\fR]
[\fB\-subj\fR \fIarg\fR]
[\fB\-utf8\fR]
[\fB\-sigopt\fR \fInm\fR:\fIv\fR]
[\fB\-create_serial\fR]
[\fB\-rand_serial\fR]
[\fB\-multivalue\-rdn\fR]
[\fB\-sm2\-id\fR \fIstring\fR]
[\fB\-sm2\-hex\-id\fR \fIhex-string\fR]
[\fB\-rand\fR \fIfiles\fR]
[\fB\-writerand\fR \fIfile\fR]
[\fB\-engine\fR \fIid\fR]
[\fIcertreq\fR...]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This command is a minimal \s-1CA\s0 application. It can be used
to sign certificate requests in a variety of forms and generate
CRLs. It also maintains a text database of issued certificates
and their status.
When signing certificates, a single certificate request can be specified
with the \fB\-in\fR option, or multiple requests can be processed by
specifying a set of \fBcertreq\fR files after all options.
.PP
The options descriptions will be divided into each purpose.
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-help\fR" 4
.IX Item "-help"
Print out a usage message.
.IP "\fB\-verbose\fR" 4
.IX Item "-verbose"
This prints extra details about the operations being performed.
.IP "\fB\-config\fR \fIfilename\fR" 4
.IX Item "-config filename"
Specifies the configuration file to use.
Optional; for a description of the default value,
see \*(L"\s-1COMMAND\s0 \s-1SUMMARY\s0\*(R" in \fIopenssl\fR\|(1).
.IP "\fB\-name\fR \fIsection\fR" 4
.IX Item "-name section"
Specifies the configuration file section to use (overrides
\&\fBdefault_ca\fR in the \fBca\fR section).
.IP "\fB\-in\fR \fIfilename\fR" 4
.IX Item "-in filename"
An input filename containing a single certificate request to be
signed by the \s-1CA\s0.
.IP "\fB\-ss_cert\fR \fIfilename\fR" 4
.IX Item "-ss_cert filename"
A single self-signed certificate to be signed by the \s-1CA\s0.
.IP "\fB\-spkac\fR \fIfilename\fR" 4
.IX Item "-spkac filename"
A file containing a single Netscape signed public key and challenge
and additional field values to be signed by the \s-1CA\s0. See the \fB\s-1SPKAC\s0 \s-1FORMAT\s0\fR
section for information on the required input and output format.
.IP "\fB\-infiles\fR" 4
.IX Item "-infiles"
If present this should be the last option, all subsequent arguments
are taken as the names of files containing certificate requests.
.IP "\fB\-out\fR \fIfilename\fR" 4
.IX Item "-out filename"
The output file to output certificates to. The default is standard
output. The certificate details will also be printed out to this
file in \s-1PEM\s0 format (except that \fB\-spkac\fR outputs \s-1DER\s0 format).
.IP "\fB\-outdir\fR \fIdirectory\fR" 4
.IX Item "-outdir directory"
The directory to output certificates to. The certificate will be
written to a filename consisting of the serial number in hex with
\&\fI.pem\fR appended.
.IP "\fB\-cert\fR" 4
.IX Item "-cert"
The \s-1CA\s0 certificate file.
.IP "\fB\-keyfile\fR \fIfilename\fR" 4
.IX Item "-keyfile filename"
The private key to sign requests with.
.IP "\fB\-keyform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR" 4
.IX Item "-keyform DER|PEM"
The format of the private key file; the default is \fB\s-1PEM\s0\fR.
See \*(L"Format Options\*(R" in \fIopenssl\fR\|(1) for details.
.IP "\fB\-sigopt\fR \fInm\fR:\fIv\fR" 4
.IX Item "-sigopt nm:v"
Pass options to the signature algorithm during sign or verify operations.
Names and values of these options are algorithm-specific.
.IP "\fB\-key\fR \fIpassword\fR" 4
.IX Item "-key password"
The password used to encrypt the private key. Since on some
systems the command line arguments are visible (e.g. Unix with
the \fIps\fR\|(1) utility) this option should be used with caution.
.IP "\fB\-selfsign\fR" 4
.IX Item "-selfsign"
Indicates the issued certificates are to be signed with the key
the certificate requests were signed with (given with \fB\-keyfile\fR).
Certificate requests signed with a different key are ignored. If
\&\fB\-spkac\fR, \fB\-ss_cert\fR or \fB\-gencrl\fR are given, \fB\-selfsign\fR is
ignored.
.Sp
A consequence of using \fB\-selfsign\fR is that the self-signed
certificate appears among the entries in the certificate database
(see the configuration option \fBdatabase\fR), and uses the same
serial number counter as all other certificates sign with the
self-signed certificate.
.IP "\fB\-passin\fR \fIarg\fR" 4
.IX Item "-passin arg"
The key password source. For more information about the format of \fBarg\fR
see \*(L"Pass Phrase Options\*(R" in \fIopenssl\fR\|(1).
.IP "\fB\-notext\fR" 4
.IX Item "-notext"
Don't output the text form of a certificate to the output file.
.IP "\fB\-startdate\fR \fIdate\fR" 4
.IX Item "-startdate date"
This allows the start date to be explicitly set. The format of the
date is \s-1YYMMDDHHMMSSZ\s0 (the same as an \s-1ASN1\s0 UTCTime structure), or
\&\s-1YYYYMMDDHHMMSSZ\s0 (the same as an \s-1ASN1\s0 GeneralizedTime structure). In
both formats, seconds \s-1SS\s0 and timezone Z must be present.
.IP "\fB\-enddate\fR \fIdate\fR" 4
.IX Item "-enddate date"
This allows the expiry date to be explicitly set. The format of the
date is \s-1YYMMDDHHMMSSZ\s0 (the same as an \s-1ASN1\s0 UTCTime structure), or
\&\s-1YYYYMMDDHHMMSSZ\s0 (the same as an \s-1ASN1\s0 GeneralizedTime structure). In
both formats, seconds \s-1SS\s0 and timezone Z must be present.
.IP "\fB\-days\fR \fIarg\fR" 4
.IX Item "-days arg"
The number of days to certify the certificate for.
.IP "\fB\-md\fR \fIalg\fR" 4
.IX Item "-md alg"
The message digest to use.
Any digest supported by the \fIopenssl\-dgst\fR\|(1) command can be used. For signing
algorithms that do not support a digest (i.e. Ed25519 and Ed448) any message
digest that is set is ignored. This option also applies to CRLs.
.IP "\fB\-policy\fR \fIarg\fR" 4
.IX Item "-policy arg"
This option defines the \s-1CA\s0 \*(L"policy\*(R" to use. This is a section in
the configuration file which decides which fields should be mandatory
or match the \s-1CA\s0 certificate. Check out the \fB\s-1POLICY\s0 \s-1FORMAT\s0\fR section
for more information.
.IP "\fB\-msie_hack\fR" 4
.IX Item "-msie_hack"
This is a deprecated option to make this command work with very old versions
of the \s-1IE\s0 certificate enrollment control \*(L"certenr3\*(R". It used UniversalStrings
for almost everything. Since the old control has various security bugs
its use is strongly discouraged.
.IP "\fB\-preserveDN\fR" 4
.IX Item "-preserveDN"
Normally the \s-1DN\s0 order of a certificate is the same as the order of the
fields in the relevant policy section. When this option is set the order
is the same as the request. This is largely for compatibility with the
older \s-1IE\s0 enrollment control which would only accept certificates if their
DNs match the order of the request. This is not needed for Xenroll.
.IP "\fB\-noemailDN\fR" 4
.IX Item "-noemailDN"
The \s-1DN\s0 of a certificate can contain the \s-1EMAIL\s0 field if present in the
request \s-1DN\s0, however it is good policy just having the e\-mail set into
the altName extension of the certificate. When this option is set the
\&\s-1EMAIL\s0 field is removed from the certificate' subject and set only in
the, eventually present, extensions. The \fBemail_in_dn\fR keyword can be
used in the configuration file to enable this behaviour.
.IP "\fB\-batch\fR" 4
.IX Item "-batch"
This sets the batch mode. In this mode no questions will be asked
and all certificates will be certified automatically.
.IP "\fB\-extensions\fR \fIsection\fR" 4
.IX Item "-extensions section"
The section of the configuration file containing certificate extensions
to be added when a certificate is issued (defaults to \fBx509_extensions\fR
unless the \fB\-extfile\fR option is used). If no extension section is
present then, a V1 certificate is created. If the extension section
is present (even if it is empty), then a V3 certificate is created. See the
\&\fIx509v3_config\fR\|(5) manual page for details of the
extension section format.
.IP "\fB\-extfile\fR \fIfile\fR" 4
.IX Item "-extfile file"
An additional configuration file to read certificate extensions from
(using the default section unless the \fB\-extensions\fR option is also
used).
.IP "\fB\-subj\fR \fIarg\fR" 4
.IX Item "-subj arg"
Supersedes subject name given in the request.
The arg must be formatted as \f(CW\*(C`/type0=value0/type1=value1/type2=...\*(C'\fR.
Keyword characters may be escaped by \f(CW\*(C`\e\*(C'\fR (backslash), and whitespace is
retained.
Empty values are permitted, but the corresponding type will not be included
in the resulting certificate.
.IP "\fB\-utf8\fR" 4
.IX Item "-utf8"
This option causes field values to be interpreted as \s-1UTF8\s0 strings, by
default they are interpreted as \s-1ASCII\s0. This means that the field
values, whether prompted from a terminal or obtained from a
configuration file, must be valid \s-1UTF8\s0 strings.
.IP "\fB\-create_serial\fR" 4
.IX Item "-create_serial"
If reading serial from the text file as specified in the configuration
fails, specifying this option creates a new random serial to be used as next
serial number.
To get random serial numbers, use the \fB\-rand_serial\fR flag instead; this
should only be used for simple error-recovery.
.IP "\fB\-rand_serial\fR" 4
.IX Item "-rand_serial"
Generate a large random number to use as the serial number.
This overrides any option or configuration to use a serial number file.
.IP "\fB\-multivalue\-rdn\fR" 4
.IX Item "-multivalue-rdn"
This option causes the \-subj argument to be interpreted with full
support for multivalued RDNs. Example:
.Sp
\&\f(CW\*(C`/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe\*(C'\fR
.Sp
If \fB\-multi\-rdn\fR is not used then the \s-1UID\s0 value is \f(CW\*(C`123456+CN=John Doe\*(C'\fR.
.IP "\fB\-sm2\-id\fR \fIstring\fR" 4
.IX Item "-sm2-id string"
Specify the \s-1ID\s0 string to use when verifying an \s-1SM2\s0 certificate. The \s-1ID\s0 string is
required by the \s-1SM2\s0 signature algorithm for signing and verification.
.IP "\fB\-sm2\-hex\-id\fR \fIhex-string\fR" 4
.IX Item "-sm2-hex-id hex-string"
Specify a binary \s-1ID\s0 string to use when signing or verifying using an \s-1SM2\s0
certificate. The argument for this option is string of hexadecimal digits.
.IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4
.IX Item "-rand files, -writerand file"
See \*(L"Random State Options\*(R" in \fIopenssl\fR\|(1) for details.
.IP "\fB\-engine\fR \fIid\fR" 4
.IX Item "-engine id"
See \*(L"Engine Options\*(R" in \fIopenssl\fR\|(1).
.SH "CRL OPTIONS"
.IX Header "CRL OPTIONS"
.IP "\fB\-gencrl\fR" 4
.IX Item "-gencrl"
This option generates a \s-1CRL\s0 based on information in the index file.
.IP "\fB\-crldays\fR \fInum\fR" 4
.IX Item "-crldays num"
The number of days before the next \s-1CRL\s0 is due. That is the days from
now to place in the \s-1CRL\s0 nextUpdate field.
.IP "\fB\-crlhours\fR \fInum\fR" 4
.IX Item "-crlhours num"
The number of hours before the next \s-1CRL\s0 is due.
.IP "\fB\-crlsec\fR \fInum\fR" 4
.IX Item "-crlsec num"
The number of seconds before the next \s-1CRL\s0 is due.
.IP "\fB\-revoke\fR \fIfilename\fR" 4
.IX Item "-revoke filename"
A filename containing a certificate to revoke.
.IP "\fB\-valid\fR \fIfilename\fR" 4
.IX Item "-valid filename"
A filename containing a certificate to add a Valid certificate entry.
.IP "\fB\-status\fR \fIserial\fR" 4
.IX Item "-status serial"
Displays the revocation status of the certificate with the specified
serial number and exits.
.IP "\fB\-updatedb\fR" 4
.IX Item "-updatedb"
Updates the database index to purge expired certificates.
.IP "\fB\-crl_reason\fR \fIreason\fR" 4
.IX Item "-crl_reason reason"
Revocation reason, where \fIreason\fR is one of: \fBunspecified\fR, \fBkeyCompromise\fR,
\&\fBCACompromise\fR, \fBaffiliationChanged\fR, \fBsuperseded\fR, \fBcessationOfOperation\fR,
\&\fBcertificateHold\fR or \fBremoveFromCRL\fR. The matching of \fIreason\fR is case
insensitive. Setting any revocation reason will make the \s-1CRL\s0 v2.
.Sp
In practice \fBremoveFromCRL\fR is not particularly useful because it is only used
in delta CRLs which are not currently implemented.
.IP "\fB\-crl_hold\fR \fIinstruction\fR" 4
.IX Item "-crl_hold instruction"
This sets the \s-1CRL\s0 revocation reason code to \fBcertificateHold\fR and the hold
instruction to \fIinstruction\fR which must be an \s-1OID\s0. Although any \s-1OID\s0 can be
used only \fBholdInstructionNone\fR (the use of which is discouraged by \s-1RFC2459\s0)
\&\fBholdInstructionCallIssuer\fR or \fBholdInstructionReject\fR will normally be used.
.IP "\fB\-crl_compromise\fR \fItime\fR" 4
.IX Item "-crl_compromise time"
This sets the revocation reason to \fBkeyCompromise\fR and the compromise time to
\&\fItime\fR. \fItime\fR should be in GeneralizedTime format that is \fI\s-1YYYYMMDDHHMMSSZ\s0\fR.
.IP "\fB\-crl_CA_compromise\fR \fItime\fR" 4
.IX Item "-crl_CA_compromise time"
This is the same as \fBcrl_compromise\fR except the revocation reason is set to
\&\fBCACompromise\fR.
.IP "\fB\-crlexts\fR \fIsection\fR" 4
.IX Item "-crlexts section"
The section of the configuration file containing \s-1CRL\s0 extensions to
include. If no \s-1CRL\s0 extension section is present then a V1 \s-1CRL\s0 is
created, if the \s-1CRL\s0 extension section is present (even if it is
empty) then a V2 \s-1CRL\s0 is created. The \s-1CRL\s0 extensions specified are
\&\s-1CRL\s0 extensions and \fBnot\fR \s-1CRL\s0 entry extensions. It should be noted
that some software (for example Netscape) can't handle V2 CRLs. See
\&\fIx509v3_config\fR\|(5) manual page for details of the
extension section format.
.SH "CONFIGURATION FILE OPTIONS"
.IX Header "CONFIGURATION FILE OPTIONS"
The section of the configuration file containing options for this command
is found as follows: If the \fB\-name\fR command line option is used,
then it names the section to be used. Otherwise the section to
be used must be named in the \fBdefault_ca\fR option of the \fBca\fR section
of the configuration file (or in the default section of the
configuration file). Besides \fBdefault_ca\fR, the following options are
read directly from the \fBca\fR section:
\s-1RANDFILE\s0
preserve
msie_hack
With the exception of \fB\s-1RANDFILE\s0\fR, this is probably a bug and may
change in future releases.
.PP
Many of the configuration file options are identical to command line
options. Where the option is present in the configuration file
and the command line the command line value is used. Where an
option is described as mandatory then it must be present in
the configuration file or the command line equivalent (if
any) used.
.IP "\fBoid_file\fR" 4
.IX Item "oid_file"
This specifies a file containing additional \fB\s-1OBJECT\s0 \s-1IDENTIFIERS\s0\fR.
Each line of the file should consist of the numerical form of the
object identifier followed by white space then the short name followed
by white space and finally the long name.
.IP "\fBoid_section\fR" 4
.IX Item "oid_section"
This specifies a section in the configuration file containing extra
object identifiers. Each line should consist of the short name of the
object identifier followed by \fB=\fR and the numerical form. The short
and long names are the same when this option is used.
.IP "\fBnew_certs_dir\fR" 4
.IX Item "new_certs_dir"
The same as the \fB\-outdir\fR command line option. It specifies
the directory where new certificates will be placed. Mandatory.
.IP "\fBcertificate\fR" 4
.IX Item "certificate"
The same as \fB\-cert\fR. It gives the file containing the \s-1CA\s0
certificate. Mandatory.
.IP "\fBprivate_key\fR" 4
.IX Item "private_key"
Same as the \fB\-keyfile\fR option. The file containing the
\&\s-1CA\s0 private key. Mandatory.
.IP "\fB\s-1RANDFILE\s0\fR" 4
.IX Item "RANDFILE"
At startup the specified file is loaded into the random number generator,
and at exit 256 bytes will be written to it. (Note: Using a \s-1RANDFILE\s0 is
not necessary anymore, see the \*(L"\s-1HISTORY\s0\*(R" section.
.IP "\fBdefault_days\fR" 4
.IX Item "default_days"
The same as the \fB\-days\fR option. The number of days to certify
a certificate for.
.IP "\fBdefault_startdate\fR" 4
.IX Item "default_startdate"
The same as the \fB\-startdate\fR option. The start date to certify
a certificate for. If not set the current time is used.
.IP "\fBdefault_enddate\fR" 4
.IX Item "default_enddate"
The same as the \fB\-enddate\fR option. Either this option or
\&\fBdefault_days\fR (or the command line equivalents) must be
present.
.IP "\fBdefault_crl_hours default_crl_days\fR" 4
.IX Item "default_crl_hours default_crl_days"
The same as the \fB\-crlhours\fR and the \fB\-crldays\fR options. These
will only be used if neither command line option is present. At
least one of these must be present to generate a \s-1CRL\s0.
.IP "\fBdefault_md\fR" 4
.IX Item "default_md"
The same as the \fB\-md\fR option. Mandatory except where the signing algorithm does
not require a digest (i.e. Ed25519 and Ed448).
.IP "\fBdatabase\fR" 4
.IX Item "database"
The text database file to use. Mandatory. This file must be present
though initially it will be empty.
.IP "\fBunique_subject\fR" 4
.IX Item "unique_subject"
If the value \fByes\fR is given, the valid certificate entries in the
database must have unique subjects. if the value \fBno\fR is given,
several valid certificate entries may have the exact same subject.
The default value is \fByes\fR, to be compatible with older (pre 0.9.8)
versions of OpenSSL. However, to make \s-1CA\s0 certificate roll-over easier,
it's recommended to use the value \fBno\fR, especially if combined with
the \fB\-selfsign\fR command line option.
.Sp
Note that it is valid in some circumstances for certificates to be created
without any subject. In the case where there are multiple certificates without
subjects this does not count as a duplicate.
.IP "\fBserial\fR" 4
.IX Item "serial"
A text file containing the next serial number to use in hex. Mandatory.
This file must be present and contain a valid serial number.
.IP "\fBcrlnumber\fR" 4
.IX Item "crlnumber"
A text file containing the next \s-1CRL\s0 number to use in hex. The crl number
will be inserted in the CRLs only if this file exists. If this file is
present, it must contain a valid \s-1CRL\s0 number.
.IP "\fBx509_extensions\fR" 4
.IX Item "x509_extensions"
The same as \fB\-extensions\fR.
.IP "\fBcrl_extensions\fR" 4
.IX Item "crl_extensions"
The same as \fB\-crlexts\fR.
.IP "\fBpreserve\fR" 4
.IX Item "preserve"
The same as \fB\-preserveDN\fR
.IP "\fBemail_in_dn\fR" 4
.IX Item "email_in_dn"
The same as \fB\-noemailDN\fR. If you want the \s-1EMAIL\s0 field to be removed
from the \s-1DN\s0 of the certificate simply set this to 'no'. If not present
the default is to allow for the \s-1EMAIL\s0 filed in the certificate's \s-1DN\s0.
.IP "\fBmsie_hack\fR" 4
.IX Item "msie_hack"
The same as \fB\-msie_hack\fR
.IP "\fBpolicy\fR" 4
.IX Item "policy"
The same as \fB\-policy\fR. Mandatory. See the \fB\s-1POLICY\s0 \s-1FORMAT\s0\fR section
for more information.
.IP "\fBname_opt\fR, \fBcert_opt\fR" 4
.IX Item "name_opt, cert_opt"
These options allow the format used to display the certificate details
when asking the user to confirm signing. All the options supported by
the \fBx509\fR utilities \fB\-nameopt\fR and \fB\-certopt\fR switches can be used
here, except the \fBno_signame\fR and \fBno_sigdump\fR are permanently set
and cannot be disabled (this is because the certificate signature cannot
be displayed because the certificate has not been signed at this point).
.Sp
For convenience the values \fBca_default\fR are accepted by both to produce
a reasonable output.
.Sp
If neither option is present the format used in earlier versions of
OpenSSL is used. Use of the old format is \fBstrongly\fR discouraged because
it only displays fields mentioned in the \fBpolicy\fR section, mishandles
multicharacter string types and does not display extensions.
.IP "\fBcopy_extensions\fR" 4
.IX Item "copy_extensions"
Determines how extensions in certificate requests should be handled.
If set to \fBnone\fR or this option is not present then extensions are
ignored and not copied to the certificate. If set to \fBcopy\fR then any
extensions present in the request that are not already present are copied
to the certificate. If set to \fBcopyall\fR then all extensions in the
request are copied to the certificate: if the extension is already present
in the certificate it is deleted first. See the \fB\s-1WARNINGS\s0\fR section before
using this option.
.Sp
The main use of this option is to allow a certificate request to supply
values for certain extensions such as subjectAltName.
.SH "POLICY FORMAT"
.IX Header "POLICY FORMAT"
The policy section consists of a set of variables corresponding to
certificate \s-1DN\s0 fields. If the value is \*(L"match\*(R" then the field value
must match the same field in the \s-1CA\s0 certificate. If the value is
\&\*(L"supplied\*(R" then it must be present. If the value is \*(L"optional\*(R" then
it may be present. Any fields not mentioned in the policy section
are silently deleted, unless the \fB\-preserveDN\fR option is set but
this can be regarded more of a quirk than intended behaviour.
.SH "SPKAC FORMAT"
.IX Header "SPKAC FORMAT"
The input to the \fB\-spkac\fR command line option is a Netscape
signed public key and challenge. This will usually come from
the \fB\s-1KEYGEN\s0\fR tag in an \s-1HTML\s0 form to create a new private key.
It is however possible to create SPKACs using \fIopenssl\-spkac\fR\|(1).
.PP
The file should contain the variable \s-1SPKAC\s0 set to the value of
the \s-1SPKAC\s0 and also the required \s-1DN\s0 components as name value pairs.
If you need to include the same component twice then it can be
preceded by a number and a '.'.
.PP
When processing \s-1SPKAC\s0 format, the output is \s-1DER\s0 if the \fB\-out\fR
flag is used, but \s-1PEM\s0 format if sending to stdout or the \fB\-outdir\fR
flag is used.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Note: these examples assume that the directory structure this command
assumes is already set up and the relevant files already exist. This
usually involves creating a \s-1CA\s0 certificate and private key with
\&\fIopenssl\-req\fR\|(1), a serial number file and an empty index file and
placing them in the relevant directories.
.PP
To use the sample configuration file below the directories \fIdemoCA\fR,
\&\fIdemoCA/private\fR and \fIdemoCA/newcerts\fR would be created. The \s-1CA\s0
certificate would be copied to \fIdemoCA/cacert.pem\fR and its private
key to \fIdemoCA/private/cakey.pem\fR. A file \fIdemoCA/serial\fR would be
created containing for example \*(L"01\*(R" and the empty index file
\&\fIdemoCA/index.txt\fR.
.PP
Sign a certificate request:
.PP
.Vb 1
\& openssl ca \-in req.pem \-out newcert.pem
.Ve
.PP
Sign an \s-1SM2\s0 certificate request:
.PP
.Vb 1
\& openssl ca \-in sm2.csr \-out sm2.crt \-md sm3 \-sigopt "sm2_id:1234567812345678" \-sm2\-id "1234567812345678"
.Ve
.PP
Sign a certificate request, using \s-1CA\s0 extensions:
.PP
.Vb 1
\& openssl ca \-in req.pem \-extensions v3_ca \-out newcert.pem
.Ve
.PP
Generate a \s-1CRL\s0
.PP
.Vb 1
\& openssl ca \-gencrl \-out crl.pem
.Ve
.PP
Sign several requests:
.PP
.Vb 1
\& openssl ca \-infiles req1.pem req2.pem req3.pem
.Ve
.PP
Certify a Netscape \s-1SPKAC:\s0
.PP
.Vb 1
\& openssl ca \-spkac spkac.txt
.Ve
.PP
A sample \s-1SPKAC\s0 file (the \s-1SPKAC\s0 line has been truncated for clarity):
.PP
.Vb 5
\& SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5
\& CN=Steve Test
\& emailAddress=steve@openssl.org
\& 0.OU=OpenSSL Group
\& 1.OU=Another Group
.Ve
.PP
A sample configuration file with the relevant sections for this command:
.PP
.Vb 2
\& [ ca ]
\& default_ca = CA_default # The default ca section
\&
\& [ CA_default ]
\&
\& dir = ./demoCA # top dir
\& database = $dir/index.txt # index file.
\& new_certs_dir = $dir/newcerts # new certs dir
\&
\& certificate = $dir/cacert.pem # The CA cert
\& serial = $dir/serial # serial no file
\& #rand_serial = yes # for random serial#\*(Aqs
\& private_key = $dir/private/cakey.pem# CA private key
\&
\& default_days = 365 # how long to certify for
\& default_crl_days= 30 # how long before next CRL
\& default_md = md5 # md to use
\&
\& policy = policy_any # default policy
\& email_in_dn = no # Don\*(Aqt add the email into cert DN
\&
\& name_opt = ca_default # Subject name display option
\& cert_opt = ca_default # Certificate display option
\& copy_extensions = none # Don\*(Aqt copy extensions from request
\&
\& [ policy_any ]
\& countryName = supplied
\& stateOrProvinceName = optional
\& organizationName = optional
\& organizationalUnitName = optional
\& commonName = supplied
\& emailAddress = optional
.Ve
.SH "FILES"
.IX Header "FILES"
Note: the location of all files can change either by compile time options,
configuration file entries, environment variables or command line options.
The values below reflect the default values.
.PP
.Vb 9
\& /usr/local/ssl/lib/openssl.cnf \- master configuration file
\& ./demoCA \- main CA directory
\& ./demoCA/cacert.pem \- CA certificate
\& ./demoCA/private/cakey.pem \- CA private key
\& ./demoCA/serial \- CA serial number file
\& ./demoCA/serial.old \- CA serial number backup file
\& ./demoCA/index.txt \- CA text database file
\& ./demoCA/index.txt.old \- CA text database backup file
\& ./demoCA/certs \- certificate output file
.Ve
.SH "RESTRICTIONS"
.IX Header "RESTRICTIONS"
The text database index file is a critical part of the process and
if corrupted it can be difficult to fix. It is theoretically possible
to rebuild the index file from all the issued certificates and a current
\&\s-1CRL:\s0 however there is no option to do this.
.PP
V2 \s-1CRL\s0 features like delta CRLs are not currently supported.
.PP
Although several requests can be input and handled at once it is only
possible to include one \s-1SPKAC\s0 or self-signed certificate.
.SH "BUGS"
.IX Header "BUGS"
The use of an in-memory text database can cause problems when large
numbers of certificates are present because, as the name implies
the database has to be kept in memory.
.PP
This command really needs rewriting or the required functionality
exposed at either a command or interface level so a more friendly utility
(perl script or \s-1GUI\s0) can handle things properly. The script
\&\fB\s-1CA\s0.pl\fR helps a little but not very much.
.PP
Any fields in a request that are not present in a policy are silently
deleted. This does not happen if the \fB\-preserveDN\fR option is used. To
enforce the absence of the \s-1EMAIL\s0 field within the \s-1DN\s0, as suggested by
RFCs, regardless the contents of the request' subject the \fB\-noemailDN\fR
option can be used. The behaviour should be more friendly and
configurable.
.PP
Canceling some commands by refusing to certify a certificate can
create an empty file.
.SH "WARNINGS"
.IX Header "WARNINGS"
This command is quirky and at times downright unfriendly.
.PP
This command was originally meant as an example of how to do
things in a \s-1CA\s0. It was not supposed to be used as a full blown \s-1CA\s0 itself:
nevertheless some people are using it for this purpose.
.PP
This command command is effectively a single user command: no locking
is done on the various files and attempts to run more than one \fBopenssl ca\fR
command on the same database can have unpredictable results.
.PP
The \fBcopy_extensions\fR option should be used with caution. If care is
not taken then it can be a security risk. For example if a certificate
request contains a basicConstraints extension with \s-1CA:TRUE\s0 and the
\&\fBcopy_extensions\fR value is set to \fBcopyall\fR and the user does not spot
this when the certificate is displayed then this will hand the requester
a valid \s-1CA\s0 certificate.
.PP
This situation can be avoided by setting \fBcopy_extensions\fR to \fBcopy\fR
and including basicConstraints with \s-1CA:FALSE\s0 in the configuration file.
Then if the request contains a basicConstraints extension it will be
ignored.
.PP
It is advisable to also include values for other extensions such
as \fBkeyUsage\fR to prevent a request supplying its own values.
.PP
Additional restrictions can be placed on the \s-1CA\s0 certificate itself.
For example if the \s-1CA\s0 certificate has:
.PP
.Vb 1
\& basicConstraints = CA:TRUE, pathlen:0
.Ve
.PP
then even if a certificate is issued with \s-1CA:TRUE\s0 it will not be valid.
.SH "HISTORY"
.IX Header "HISTORY"
Since OpenSSL 1.1.1, the program follows \s-1RFC5280\s0. Specifically,
certificate validity period (specified by any of \fB\-startdate\fR,
\&\fB\-enddate\fR and \fB\-days\fR) will be encoded as UTCTime if the dates are
earlier than year 2049 (included), and as GeneralizedTime if the dates
are in year 2050 or later.
.PP
OpenSSL 1.1.1 introduced a new random generator (\s-1CSPRNG\s0) with an improved
seeding mechanism. The new seeding mechanism makes it unnecessary to
define a \s-1RANDFILE\s0 for saving and restoring randomness. This option is
retained mainly for compatibility reasons.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIopenssl\fR\|(1),
\&\fIopenssl\-req\fR\|(1),
\&\fIopenssl\-spkac\fR\|(1),
\&\fIopenssl\-x509\fR\|(1),
\&\s-1\fICA\s0.pl\fR\|(1),
\&\fIconfig\fR\|(5),
\&\fIx509v3_config\fR\|(5)
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2000\-2019 The OpenSSL Project Authors. All Rights Reserved.
.PP
Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file \s-1LICENSE\s0 in the source distribution or at
<https://www.openssl.org/source/license.html>.