man-pages/man1/ca.1ssl.html
2021-03-31 01:06:50 +01:00

962 lines
32 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CA</TITLE>
</HEAD><BODY>
<H1>CA</H1>
Section: OpenSSL (1SSL)<BR>Updated: 2021-03-22<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
openssl-ca, ca - sample minimal CA application
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>openssl</B> <B>ca</B>
[<B>-help</B>]
[<B>-verbose</B>]
[<B>-config filename</B>]
[<B>-name section</B>]
[<B>-gencrl</B>]
[<B>-revoke file</B>]
[<B>-valid file</B>]
[<B>-status serial</B>]
[<B>-updatedb</B>]
[<B>-crl_reason reason</B>]
[<B>-crl_hold instruction</B>]
[<B>-crl_compromise time</B>]
[<B>-crl_CA_compromise time</B>]
[<B>-crldays days</B>]
[<B>-crlhours hours</B>]
[<B>-crlexts section</B>]
[<B>-startdate date</B>]
[<B>-enddate date</B>]
[<B>-days arg</B>]
[<B>-md arg</B>]
[<B>-policy arg</B>]
[<B>-keyfile arg</B>]
[<B>-keyform PEM|DER</B>]
[<B>-key arg</B>]
[<B>-passin arg</B>]
[<B>-cert file</B>]
[<B>-selfsign</B>]
[<B>-in file</B>]
[<B>-out file</B>]
[<B>-notext</B>]
[<B>-outdir dir</B>]
[<B>-infiles</B>]
[<B>-spkac file</B>]
[<B>-ss_cert file</B>]
[<B>-preserveDN</B>]
[<B>-noemailDN</B>]
[<B>-batch</B>]
[<B>-msie_hack</B>]
[<B>-extensions section</B>]
[<B>-extfile section</B>]
[<B>-engine id</B>]
[<B>-subj arg</B>]
[<B>-utf8</B>]
[<B>-sigopt nm:v</B>]
[<B>-create_serial</B>]
[<B>-rand_serial</B>]
[<B>-multivalue-rdn</B>]
[<B>-rand file...</B>]
[<B>-writerand file</B>]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>ca</B> command is a minimal <FONT SIZE="-1">CA</FONT> 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.
<P>
The options descriptions will be divided into each purpose.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-help</B><DD>
Print out a usage message.
<DT id="2"><B>-verbose</B><DD>
This prints extra details about the operations being performed.
<DT id="3"><B>-config filename</B><DD>
Specifies the configuration file to use.
Optional; for a description of the default value,
see ``<FONT SIZE="-1">COMMAND SUMMARY''</FONT> in <B><A HREF="/cgi-bin/man/man2html?1+openssl">openssl</A></B>(1).
<DT id="4"><B>-name section</B><DD>
Specifies the configuration file section to use (overrides
<B>default_ca</B> in the <B>ca</B> section).
<DT id="5"><B>-in filename</B><DD>
An input filename containing a single certificate request to be
signed by the <FONT SIZE="-1">CA.</FONT>
<DT id="6"><B>-ss_cert filename</B><DD>
A single self-signed certificate to be signed by the <FONT SIZE="-1">CA.</FONT>
<DT id="7"><B>-spkac filename</B><DD>
A file containing a single Netscape signed public key and challenge
and additional field values to be signed by the <FONT SIZE="-1">CA.</FONT> See the <B></B><FONT SIZE="-1"><B>SPKAC FORMAT</B></FONT><B></B>
section for information on the required input and output format.
<DT id="8"><B>-infiles</B><DD>
If present this should be the last option, all subsequent arguments
are taken as the names of files containing certificate requests.
<DT id="9"><B>-out filename</B><DD>
The output file to output certificates to. The default is standard
output. The certificate details will also be printed out to this
file in <FONT SIZE="-1">PEM</FONT> format (except that <B>-spkac</B> outputs <FONT SIZE="-1">DER</FONT> format).
<DT id="10"><B>-outdir directory</B><DD>
The directory to output certificates to. The certificate will be
written to a filename consisting of the serial number in hex with
``.pem'' appended.
<DT id="11"><B>-cert</B><DD>
The <FONT SIZE="-1">CA</FONT> certificate file.
<DT id="12"><B>-keyfile filename</B><DD>
The private key to sign requests with.
<DT id="13"><B>-keyform PEM|DER</B><DD>
The format of the data in the private key file.
The default is <FONT SIZE="-1">PEM.</FONT>
<DT id="14"><B>-sigopt nm:v</B><DD>
Pass options to the signature algorithm during sign or verify operations.
Names and values of these options are algorithm-specific.
<DT id="15"><B>-key password</B><DD>
The password used to encrypt the private key. Since on some
systems the command line arguments are visible (e.g. Unix with
the 'ps' utility) this option should be used with caution.
<DT id="16"><B>-selfsign</B><DD>
Indicates the issued certificates are to be signed with the key
the certificate requests were signed with (given with <B>-keyfile</B>).
Certificate requests signed with a different key are ignored. If
<B>-spkac</B>, <B>-ss_cert</B> or <B>-gencrl</B> are given, <B>-selfsign</B> is
ignored.
<P>
A consequence of using <B>-selfsign</B> is that the self-signed
certificate appears among the entries in the certificate database
(see the configuration option <B>database</B>), and uses the same
serial number counter as all other certificates sign with the
self-signed certificate.
<DT id="17"><B>-passin arg</B><DD>
The key password source. For more information about the format of <B>arg</B>
see the <B></B><FONT SIZE="-1"><B>PASS PHRASE ARGUMENTS</B></FONT><B></B> section in <B><A HREF="/cgi-bin/man/man2html?1+openssl">openssl</A></B>(1).
<DT id="18"><B>-notext</B><DD>
Don't output the text form of a certificate to the output file.
<DT id="19"><B>-startdate date</B><DD>
This allows the start date to be explicitly set. The format of the
date is <FONT SIZE="-1">YYMMDDHHMMSSZ</FONT> (the same as an <FONT SIZE="-1">ASN1</FONT> UTCTime structure), or
<FONT SIZE="-1">YYYYMMDDHHMMSSZ</FONT> (the same as an <FONT SIZE="-1">ASN1</FONT> GeneralizedTime structure). In
both formats, seconds <FONT SIZE="-1">SS</FONT> and timezone Z must be present.
<DT id="20"><B>-enddate date</B><DD>
This allows the expiry date to be explicitly set. The format of the
date is <FONT SIZE="-1">YYMMDDHHMMSSZ</FONT> (the same as an <FONT SIZE="-1">ASN1</FONT> UTCTime structure), or
<FONT SIZE="-1">YYYYMMDDHHMMSSZ</FONT> (the same as an <FONT SIZE="-1">ASN1</FONT> GeneralizedTime structure). In
both formats, seconds <FONT SIZE="-1">SS</FONT> and timezone Z must be present.
<DT id="21"><B>-days arg</B><DD>
The number of days to certify the certificate for.
<DT id="22"><B>-md alg</B><DD>
The message digest to use.
Any digest supported by the OpenSSL <B>dgst</B> 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.
<DT id="23"><B>-policy arg</B><DD>
This option defines the <FONT SIZE="-1">CA</FONT> ``policy'' to use. This is a section in
the configuration file which decides which fields should be mandatory
or match the <FONT SIZE="-1">CA</FONT> certificate. Check out the <B></B><FONT SIZE="-1"><B>POLICY FORMAT</B></FONT><B></B> section
for more information.
<DT id="24"><B>-msie_hack</B><DD>
This is a deprecated option to make <B>ca</B> work with very old versions of
the <FONT SIZE="-1">IE</FONT> certificate enrollment control ``certenr3''. It used UniversalStrings
for almost everything. Since the old control has various security bugs
its use is strongly discouraged.
<DT id="25"><B>-preserveDN</B><DD>
Normally the <FONT SIZE="-1">DN</FONT> 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 <FONT SIZE="-1">IE</FONT> enrollment control which would only accept certificates if their
DNs match the order of the request. This is not needed for Xenroll.
<DT id="26"><B>-noemailDN</B><DD>
The <FONT SIZE="-1">DN</FONT> of a certificate can contain the <FONT SIZE="-1">EMAIL</FONT> field if present in the
request <FONT SIZE="-1">DN,</FONT> however it is good policy just having the e-mail set into
the altName extension of the certificate. When this option is set the
<FONT SIZE="-1">EMAIL</FONT> field is removed from the certificate' subject and set only in
the, eventually present, extensions. The <B>email_in_dn</B> keyword can be
used in the configuration file to enable this behaviour.
<DT id="27"><B>-batch</B><DD>
This sets the batch mode. In this mode no questions will be asked
and all certificates will be certified automatically.
<DT id="28"><B>-extensions section</B><DD>
The section of the configuration file containing certificate extensions
to be added when a certificate is issued (defaults to <B>x509_extensions</B>
unless the <B>-extfile</B> 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
<B><A HREF="/cgi-bin/man/man2html?5+x509v3_config">x509v3_config</A></B>(5) manual page for details of the
extension section format.
<DT id="29"><B>-extfile file</B><DD>
An additional configuration file to read certificate extensions from
(using the default section unless the <B>-extensions</B> option is also
used).
<DT id="30"><B>-engine id</B><DD>
Specifying an engine (by its unique <B>id</B> string) will cause <B>ca</B>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.
<DT id="31"><B>-subj arg</B><DD>
Supersedes subject name given in the request.
The arg must be formatted as <I>/type0=value0/type1=value1/type2=...</I>.
Keyword characters may be escaped by \ (backslash), and whitespace is retained.
Empty values are permitted, but the corresponding type will not be included
in the resulting certificate.
<DT id="32"><B>-utf8</B><DD>
This option causes field values to be interpreted as <FONT SIZE="-1">UTF8</FONT> strings, by
default they are interpreted as <FONT SIZE="-1">ASCII.</FONT> This means that the field
values, whether prompted from a terminal or obtained from a
configuration file, must be valid <FONT SIZE="-1">UTF8</FONT> strings.
<DT id="33"><B>-create_serial</B><DD>
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 <B>-rand_serial</B> flag instead; this
should only be used for simple error-recovery.
<DT id="34"><B>-rand_serial</B><DD>
Generate a large random number to use as the serial number.
This overrides any option or configuration to use a serial number file.
<DT id="35"><B>-multivalue-rdn</B><DD>
This option causes the -subj argument to be interpreted with full
support for multivalued RDNs. Example:
<P>
<I>/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe</I>
<P>
If -multi-rdn is not used then the <FONT SIZE="-1">UID</FONT> value is <I>123456+CN=John Doe</I>.
<DT id="36"><B>-rand file...</B><DD>
A file or files containing random data used to seed the random number
generator.
Multiple files can be specified separated by an OS-dependent character.
The separator is <B>;</B> for MS-Windows, <B>,</B> for OpenVMS, and <B>:</B> for
all others.
<DT id="37">[<B>-writerand file</B>]<DD>
Writes random data to the specified <I>file</I> upon exit.
This can be used with a subsequent <B>-rand</B> flag.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>CRL OPTIONS</H2>
<DL COMPACT>
<DT id="38"><B>-gencrl</B><DD>
This option generates a <FONT SIZE="-1">CRL</FONT> based on information in the index file.
<DT id="39"><B>-crldays num</B><DD>
The number of days before the next <FONT SIZE="-1">CRL</FONT> is due. That is the days from
now to place in the <FONT SIZE="-1">CRL</FONT> nextUpdate field.
<DT id="40"><B>-crlhours num</B><DD>
The number of hours before the next <FONT SIZE="-1">CRL</FONT> is due.
<DT id="41"><B>-revoke filename</B><DD>
A filename containing a certificate to revoke.
<DT id="42"><B>-valid filename</B><DD>
A filename containing a certificate to add a Valid certificate entry.
<DT id="43"><B>-status serial</B><DD>
Displays the revocation status of the certificate with the specified
serial number and exits.
<DT id="44"><B>-updatedb</B><DD>
Updates the database index to purge expired certificates.
<DT id="45"><B>-crl_reason reason</B><DD>
Revocation reason, where <B>reason</B> is one of: <B>unspecified</B>, <B>keyCompromise</B>,
<B>CACompromise</B>, <B>affiliationChanged</B>, <B>superseded</B>, <B>cessationOfOperation</B>,
<B>certificateHold</B> or <B>removeFromCRL</B>. The matching of <B>reason</B> is case
insensitive. Setting any revocation reason will make the <FONT SIZE="-1">CRL</FONT> v2.
<P>
In practice <B>removeFromCRL</B> is not particularly useful because it is only used
in delta CRLs which are not currently implemented.
<DT id="46"><B>-crl_hold instruction</B><DD>
This sets the <FONT SIZE="-1">CRL</FONT> revocation reason code to <B>certificateHold</B> and the hold
instruction to <B>instruction</B> which must be an <FONT SIZE="-1">OID.</FONT> Although any <FONT SIZE="-1">OID</FONT> can be
used only <B>holdInstructionNone</B> (the use of which is discouraged by <FONT SIZE="-1">RFC2459</FONT>)
<B>holdInstructionCallIssuer</B> or <B>holdInstructionReject</B> will normally be used.
<DT id="47"><B>-crl_compromise time</B><DD>
This sets the revocation reason to <B>keyCompromise</B> and the compromise time to
<B>time</B>. <B>time</B> should be in GeneralizedTime format that is <B></B><FONT SIZE="-1"><B>YYYYMMDDHHMMSSZ</B></FONT><B></B>.
<DT id="48"><B>-crl_CA_compromise time</B><DD>
This is the same as <B>crl_compromise</B> except the revocation reason is set to
<B>CACompromise</B>.
<DT id="49"><B>-crlexts section</B><DD>
The section of the configuration file containing <FONT SIZE="-1">CRL</FONT> extensions to
include. If no <FONT SIZE="-1">CRL</FONT> extension section is present then a V1 <FONT SIZE="-1">CRL</FONT> is
created, if the <FONT SIZE="-1">CRL</FONT> extension section is present (even if it is
empty) then a V2 <FONT SIZE="-1">CRL</FONT> is created. The <FONT SIZE="-1">CRL</FONT> extensions specified are
<FONT SIZE="-1">CRL</FONT> extensions and <B>not</B> <FONT SIZE="-1">CRL</FONT> entry extensions. It should be noted
that some software (for example Netscape) can't handle V2 CRLs. See
<B><A HREF="/cgi-bin/man/man2html?5+x509v3_config">x509v3_config</A></B>(5) manual page for details of the
extension section format.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>CONFIGURATION FILE OPTIONS</H2>
The section of the configuration file containing options for <B>ca</B>
is found as follows: If the <B>-name</B> command line option is used,
then it names the section to be used. Otherwise the section to
be used must be named in the <B>default_ca</B> option of the <B>ca</B> section
of the configuration file (or in the default section of the
configuration file). Besides <B>default_ca</B>, the following options are
read directly from the <B>ca</B> section:
<BR>&nbsp;<FONT SIZE="-1">RANDFILE</FONT>
<BR>&nbsp;preserve
<BR>&nbsp;msie_hack
With the exception of <B></B><FONT SIZE="-1"><B>RANDFILE</B></FONT><B></B>, this is probably a bug and may
change in future releases.
<P>
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.
<DL COMPACT>
<DT id="50"><B>oid_file</B><DD>
This specifies a file containing additional <B></B><FONT SIZE="-1"><B>OBJECT IDENTIFIERS</B></FONT><B></B>.
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.
<DT id="51"><B>oid_section</B><DD>
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 <B>=</B> and the numerical form. The short
and long names are the same when this option is used.
<DT id="52"><B>new_certs_dir</B><DD>
The same as the <B>-outdir</B> command line option. It specifies
the directory where new certificates will be placed. Mandatory.
<DT id="53"><B>certificate</B><DD>
The same as <B>-cert</B>. It gives the file containing the <FONT SIZE="-1">CA</FONT>
certificate. Mandatory.
<DT id="54"><B>private_key</B><DD>
Same as the <B>-keyfile</B> option. The file containing the
<FONT SIZE="-1">CA</FONT> private key. Mandatory.
<DT id="55"><B></B><FONT SIZE="-1"><B>RANDFILE</B></FONT><B></B><DD>
At startup the specified file is loaded into the random number generator,
and at exit 256 bytes will be written to it.
<DT id="56"><B>default_days</B><DD>
The same as the <B>-days</B> option. The number of days to certify
a certificate for.
<DT id="57"><B>default_startdate</B><DD>
The same as the <B>-startdate</B> option. The start date to certify
a certificate for. If not set the current time is used.
<DT id="58"><B>default_enddate</B><DD>
The same as the <B>-enddate</B> option. Either this option or
<B>default_days</B> (or the command line equivalents) must be
present.
<DT id="59"><B>default_crl_hours default_crl_days</B><DD>
The same as the <B>-crlhours</B> and the <B>-crldays</B> options. These
will only be used if neither command line option is present. At
least one of these must be present to generate a <FONT SIZE="-1">CRL.</FONT>
<DT id="60"><B>default_md</B><DD>
The same as the <B>-md</B> option. Mandatory except where the signing algorithm does
not require a digest (i.e. Ed25519 and Ed448).
<DT id="61"><B>database</B><DD>
The text database file to use. Mandatory. This file must be present
though initially it will be empty.
<DT id="62"><B>unique_subject</B><DD>
If the value <B>yes</B> is given, the valid certificate entries in the
database must have unique subjects. if the value <B>no</B> is given,
several valid certificate entries may have the exact same subject.
The default value is <B>yes</B>, to be compatible with older (pre 0.9.8)
versions of OpenSSL. However, to make <FONT SIZE="-1">CA</FONT> certificate roll-over easier,
it's recommended to use the value <B>no</B>, especially if combined with
the <B>-selfsign</B> command line option.
<P>
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.
<DT id="63"><B>serial</B><DD>
A text file containing the next serial number to use in hex. Mandatory.
This file must be present and contain a valid serial number.
<DT id="64"><B>crlnumber</B><DD>
A text file containing the next <FONT SIZE="-1">CRL</FONT> 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 <FONT SIZE="-1">CRL</FONT> number.
<DT id="65"><B>x509_extensions</B><DD>
The same as <B>-extensions</B>.
<DT id="66"><B>crl_extensions</B><DD>
The same as <B>-crlexts</B>.
<DT id="67"><B>preserve</B><DD>
The same as <B>-preserveDN</B>
<DT id="68"><B>email_in_dn</B><DD>
The same as <B>-noemailDN</B>. If you want the <FONT SIZE="-1">EMAIL</FONT> field to be removed
from the <FONT SIZE="-1">DN</FONT> of the certificate simply set this to 'no'. If not present
the default is to allow for the <FONT SIZE="-1">EMAIL</FONT> filed in the certificate's <FONT SIZE="-1">DN.</FONT>
<DT id="69"><B>msie_hack</B><DD>
The same as <B>-msie_hack</B>
<DT id="70"><B>policy</B><DD>
The same as <B>-policy</B>. Mandatory. See the <B></B><FONT SIZE="-1"><B>POLICY FORMAT</B></FONT><B></B> section
for more information.
<DT id="71"><B>name_opt</B>, <B>cert_opt</B><DD>
These options allow the format used to display the certificate details
when asking the user to confirm signing. All the options supported by
the <B>x509</B> utilities <B>-nameopt</B> and <B>-certopt</B> switches can be used
here, except the <B>no_signame</B> and <B>no_sigdump</B> 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).
<P>
For convenience the values <B>ca_default</B> are accepted by both to produce
a reasonable output.
<P>
If neither option is present the format used in earlier versions of
OpenSSL is used. Use of the old format is <B>strongly</B> discouraged because
it only displays fields mentioned in the <B>policy</B> section, mishandles
multicharacter string types and does not display extensions.
<DT id="72"><B>copy_extensions</B><DD>
Determines how extensions in certificate requests should be handled.
If set to <B>none</B> or this option is not present then extensions are
ignored and not copied to the certificate. If set to <B>copy</B> then any
extensions present in the request that are not already present are copied
to the certificate. If set to <B>copyall</B> 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 <B></B><FONT SIZE="-1"><B>WARNINGS</B></FONT><B></B> section before
using this option.
<P>
The main use of this option is to allow a certificate request to supply
values for certain extensions such as subjectAltName.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>POLICY FORMAT</H2>
The policy section consists of a set of variables corresponding to
certificate <FONT SIZE="-1">DN</FONT> fields. If the value is ``match'' then the field value
must match the same field in the <FONT SIZE="-1">CA</FONT> certificate. If the value is
``supplied'' then it must be present. If the value is ``optional'' then
it may be present. Any fields not mentioned in the policy section
are silently deleted, unless the <B>-preserveDN</B> option is set but
this can be regarded more of a quirk than intended behaviour.
<A NAME="lbAI">&nbsp;</A>
<H2>SPKAC FORMAT</H2>
The input to the <B>-spkac</B> command line option is a Netscape
signed public key and challenge. This will usually come from
the <B></B><FONT SIZE="-1"><B>KEYGEN</B></FONT><B></B> tag in an <FONT SIZE="-1">HTML</FONT> form to create a new private key.
It is however possible to create SPKACs using the <B>spkac</B> utility.
<P>
The file should contain the variable <FONT SIZE="-1">SPKAC</FONT> set to the value of
the <FONT SIZE="-1">SPKAC</FONT> and also the required <FONT SIZE="-1">DN</FONT> components as name value pairs.
If you need to include the same component twice then it can be
preceded by a number and a '.'.
<P>
When processing <FONT SIZE="-1">SPKAC</FONT> format, the output is <FONT SIZE="-1">DER</FONT> if the <B>-out</B>
flag is used, but <FONT SIZE="-1">PEM</FONT> format if sending to stdout or the <B>-outdir</B>
flag is used.
<A NAME="lbAJ">&nbsp;</A>
<H2>EXAMPLES</H2>
Note: these examples assume that the <B>ca</B> directory structure is
already set up and the relevant files already exist. This usually
involves creating a <FONT SIZE="-1">CA</FONT> certificate and private key with <B>req</B>, a
serial number file and an empty index file and placing them in
the relevant directories.
<P>
To use the sample configuration file below the directories demoCA,
demoCA/private and demoCA/newcerts would be created. The <FONT SIZE="-1">CA</FONT>
certificate would be copied to demoCA/cacert.pem and its private
key to demoCA/private/cakey.pem. A file demoCA/serial would be
created containing for example ``01'' and the empty index file
demoCA/index.txt.
<P>
Sign a certificate request:
<P>
<PRE>
openssl ca -in req.pem -out newcert.pem
</PRE>
<P>
Sign a certificate request, using <FONT SIZE="-1">CA</FONT> extensions:
<P>
<PRE>
openssl ca -in req.pem -extensions v3_ca -out newcert.pem
</PRE>
<P>
Generate a <FONT SIZE="-1">CRL</FONT>
<P>
<PRE>
openssl ca -gencrl -out crl.pem
</PRE>
<P>
Sign several requests:
<P>
<PRE>
openssl ca -infiles req1.pem req2.pem req3.pem
</PRE>
<P>
Certify a Netscape <FONT SIZE="-1">SPKAC:</FONT>
<P>
<PRE>
openssl ca -spkac spkac.txt
</PRE>
<P>
A sample <FONT SIZE="-1">SPKAC</FONT> file (the <FONT SIZE="-1">SPKAC</FONT> line has been truncated for clarity):
<P>
<PRE>
SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5
CN=Steve Test
emailAddress=<A HREF="mailto:steve@openssl.org">steve@openssl.org</A>
0.OU=OpenSSL Group
1.OU=Another Group
</PRE>
<P>
A sample configuration file with the relevant sections for <B>ca</B>:
<P>
<PRE>
[ 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#'s
private_key = $dir/private/cakey.pem# CA private key
RANDFILE = $dir/private/.rand # random number file
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't 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't copy extensions from request
[ policy_any ]
countryName = supplied
stateOrProvinceName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
</PRE>
<A NAME="lbAK">&nbsp;</A>
<H2>FILES</H2>
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.
<P>
<PRE>
/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
./demoCA/.rnd - CA random seed information
</PRE>
<A NAME="lbAL">&nbsp;</A>
<H2>RESTRICTIONS</H2>
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
<FONT SIZE="-1">CRL:</FONT> however there is no option to do this.
<P>
V2 <FONT SIZE="-1">CRL</FONT> features like delta CRLs are not currently supported.
<P>
Although several requests can be input and handled at once it is only
possible to include one <FONT SIZE="-1">SPKAC</FONT> or self-signed certificate.
<A NAME="lbAM">&nbsp;</A>
<H2>BUGS</H2>
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.
<P>
The <B>ca</B> command really needs rewriting or the required functionality
exposed at either a command or interface level so a more friendly utility
(perl script or <FONT SIZE="-1">GUI</FONT>) can handle things properly. The script
<B></B><FONT SIZE="-1"><B>CA</B></FONT><B>.pl</B> helps a little but not very much.
<P>
Any fields in a request that are not present in a policy are silently
deleted. This does not happen if the <B>-preserveDN</B> option is used. To
enforce the absence of the <FONT SIZE="-1">EMAIL</FONT> field within the <FONT SIZE="-1">DN,</FONT> as suggested by
RFCs, regardless the contents of the request' subject the <B>-noemailDN</B>
option can be used. The behaviour should be more friendly and
configurable.
<P>
Canceling some commands by refusing to certify a certificate can
create an empty file.
<A NAME="lbAN">&nbsp;</A>
<H2>WARNINGS</H2>
The <B>ca</B> command is quirky and at times downright unfriendly.
<P>
The <B>ca</B> utility was originally meant as an example of how to do things
in a <FONT SIZE="-1">CA.</FONT> It was not supposed to be used as a full blown <FONT SIZE="-1">CA</FONT> itself:
nevertheless some people are using it for this purpose.
<P>
The <B>ca</B> command is effectively a single user command: no locking is
done on the various files and attempts to run more than one <B>ca</B> command
on the same database can have unpredictable results.
<P>
The <B>copy_extensions</B> 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 <FONT SIZE="-1">CA:TRUE</FONT> and the
<B>copy_extensions</B> value is set to <B>copyall</B> and the user does not spot
this when the certificate is displayed then this will hand the requester
a valid <FONT SIZE="-1">CA</FONT> certificate.
<P>
This situation can be avoided by setting <B>copy_extensions</B> to <B>copy</B>
and including basicConstraints with <FONT SIZE="-1">CA:FALSE</FONT> in the configuration file.
Then if the request contains a basicConstraints extension it will be
ignored.
<P>
It is advisable to also include values for other extensions such
as <B>keyUsage</B> to prevent a request supplying its own values.
<P>
Additional restrictions can be placed on the <FONT SIZE="-1">CA</FONT> certificate itself.
For example if the <FONT SIZE="-1">CA</FONT> certificate has:
<P>
<PRE>
basicConstraints = CA:TRUE, pathlen:0
</PRE>
<P>
then even if a certificate is issued with <FONT SIZE="-1">CA:TRUE</FONT> it will not be valid.
<A NAME="lbAO">&nbsp;</A>
<H2>HISTORY</H2>
Since OpenSSL 1.1.1, the program follows <FONT SIZE="-1">RFC5280.</FONT> Specifically,
certificate validity period (specified by any of <B>-startdate</B>,
<B>-enddate</B> and <B>-days</B>) 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.
<A NAME="lbAP">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+req">req</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+spkac">spkac</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+x509">x509</A></B>(1), <FONT SIZE="-1"><B>CA</B></FONT><B><A HREF="/cgi-bin/man/man2html?1+.pl">.pl</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?5+config">config</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+x509v3_config">x509v3_config</A></B>(5)
<A NAME="lbAQ">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
<P>
Licensed under the OpenSSL license (the ``License''). You may not use
this file except in compliance with the License. You can obtain a copy
in the file <FONT SIZE="-1">LICENSE</FONT> in the source distribution or at
&lt;<A HREF="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</A>&gt;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="73"><A HREF="#lbAB">NAME</A><DD>
<DT id="74"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="75"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="76"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="77"><A HREF="#lbAF">CRL OPTIONS</A><DD>
<DT id="78"><A HREF="#lbAG">CONFIGURATION FILE OPTIONS</A><DD>
<DT id="79"><A HREF="#lbAH">POLICY FORMAT</A><DD>
<DT id="80"><A HREF="#lbAI">SPKAC FORMAT</A><DD>
<DT id="81"><A HREF="#lbAJ">EXAMPLES</A><DD>
<DT id="82"><A HREF="#lbAK">FILES</A><DD>
<DT id="83"><A HREF="#lbAL">RESTRICTIONS</A><DD>
<DT id="84"><A HREF="#lbAM">BUGS</A><DD>
<DT id="85"><A HREF="#lbAN">WARNINGS</A><DD>
<DT id="86"><A HREF="#lbAO">HISTORY</A><DD>
<DT id="87"><A HREF="#lbAP">SEE ALSO</A><DD>
<DT id="88"><A HREF="#lbAQ">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:08 GMT, March 31, 2021
</BODY>
</HTML>