1*4724848cSchristos=pod 2*4724848cSchristos 3*4724848cSchristos=head1 NAME 4*4724848cSchristos 5*4724848cSchristosopenssl-ca, 6*4724848cSchristosca - sample minimal CA application 7*4724848cSchristos 8*4724848cSchristos=head1 SYNOPSIS 9*4724848cSchristos 10*4724848cSchristosB<openssl> B<ca> 11*4724848cSchristos[B<-help>] 12*4724848cSchristos[B<-verbose>] 13*4724848cSchristos[B<-config filename>] 14*4724848cSchristos[B<-name section>] 15*4724848cSchristos[B<-gencrl>] 16*4724848cSchristos[B<-revoke file>] 17*4724848cSchristos[B<-valid file>] 18*4724848cSchristos[B<-status serial>] 19*4724848cSchristos[B<-updatedb>] 20*4724848cSchristos[B<-crl_reason reason>] 21*4724848cSchristos[B<-crl_hold instruction>] 22*4724848cSchristos[B<-crl_compromise time>] 23*4724848cSchristos[B<-crl_CA_compromise time>] 24*4724848cSchristos[B<-crldays days>] 25*4724848cSchristos[B<-crlhours hours>] 26*4724848cSchristos[B<-crlexts section>] 27*4724848cSchristos[B<-startdate date>] 28*4724848cSchristos[B<-enddate date>] 29*4724848cSchristos[B<-days arg>] 30*4724848cSchristos[B<-md arg>] 31*4724848cSchristos[B<-policy arg>] 32*4724848cSchristos[B<-keyfile arg>] 33*4724848cSchristos[B<-keyform PEM|DER>] 34*4724848cSchristos[B<-key arg>] 35*4724848cSchristos[B<-passin arg>] 36*4724848cSchristos[B<-cert file>] 37*4724848cSchristos[B<-selfsign>] 38*4724848cSchristos[B<-in file>] 39*4724848cSchristos[B<-out file>] 40*4724848cSchristos[B<-notext>] 41*4724848cSchristos[B<-outdir dir>] 42*4724848cSchristos[B<-infiles>] 43*4724848cSchristos[B<-spkac file>] 44*4724848cSchristos[B<-ss_cert file>] 45*4724848cSchristos[B<-preserveDN>] 46*4724848cSchristos[B<-noemailDN>] 47*4724848cSchristos[B<-batch>] 48*4724848cSchristos[B<-msie_hack>] 49*4724848cSchristos[B<-extensions section>] 50*4724848cSchristos[B<-extfile section>] 51*4724848cSchristos[B<-engine id>] 52*4724848cSchristos[B<-subj arg>] 53*4724848cSchristos[B<-utf8>] 54*4724848cSchristos[B<-sigopt nm:v>] 55*4724848cSchristos[B<-create_serial>] 56*4724848cSchristos[B<-rand_serial>] 57*4724848cSchristos[B<-multivalue-rdn>] 58*4724848cSchristos[B<-rand file...>] 59*4724848cSchristos[B<-writerand file>] 60*4724848cSchristos 61*4724848cSchristos=head1 DESCRIPTION 62*4724848cSchristos 63*4724848cSchristosThe B<ca> command is a minimal CA application. It can be used 64*4724848cSchristosto sign certificate requests in a variety of forms and generate 65*4724848cSchristosCRLs it also maintains a text database of issued certificates 66*4724848cSchristosand their status. 67*4724848cSchristos 68*4724848cSchristosThe options descriptions will be divided into each purpose. 69*4724848cSchristos 70*4724848cSchristos=head1 OPTIONS 71*4724848cSchristos 72*4724848cSchristos=over 4 73*4724848cSchristos 74*4724848cSchristos=item B<-help> 75*4724848cSchristos 76*4724848cSchristosPrint out a usage message. 77*4724848cSchristos 78*4724848cSchristos=item B<-verbose> 79*4724848cSchristos 80*4724848cSchristosThis prints extra details about the operations being performed. 81*4724848cSchristos 82*4724848cSchristos=item B<-config filename> 83*4724848cSchristos 84*4724848cSchristosSpecifies the configuration file to use. 85*4724848cSchristosOptional; for a description of the default value, 86*4724848cSchristossee L<openssl(1)/COMMAND SUMMARY>. 87*4724848cSchristos 88*4724848cSchristos=item B<-name section> 89*4724848cSchristos 90*4724848cSchristosSpecifies the configuration file section to use (overrides 91*4724848cSchristosB<default_ca> in the B<ca> section). 92*4724848cSchristos 93*4724848cSchristos=item B<-in filename> 94*4724848cSchristos 95*4724848cSchristosAn input filename containing a single certificate request to be 96*4724848cSchristossigned by the CA. 97*4724848cSchristos 98*4724848cSchristos=item B<-ss_cert filename> 99*4724848cSchristos 100*4724848cSchristosA single self-signed certificate to be signed by the CA. 101*4724848cSchristos 102*4724848cSchristos=item B<-spkac filename> 103*4724848cSchristos 104*4724848cSchristosA file containing a single Netscape signed public key and challenge 105*4724848cSchristosand additional field values to be signed by the CA. See the B<SPKAC FORMAT> 106*4724848cSchristossection for information on the required input and output format. 107*4724848cSchristos 108*4724848cSchristos=item B<-infiles> 109*4724848cSchristos 110*4724848cSchristosIf present this should be the last option, all subsequent arguments 111*4724848cSchristosare taken as the names of files containing certificate requests. 112*4724848cSchristos 113*4724848cSchristos=item B<-out filename> 114*4724848cSchristos 115*4724848cSchristosThe output file to output certificates to. The default is standard 116*4724848cSchristosoutput. The certificate details will also be printed out to this 117*4724848cSchristosfile in PEM format (except that B<-spkac> outputs DER format). 118*4724848cSchristos 119*4724848cSchristos=item B<-outdir directory> 120*4724848cSchristos 121*4724848cSchristosThe directory to output certificates to. The certificate will be 122*4724848cSchristoswritten to a filename consisting of the serial number in hex with 123*4724848cSchristos".pem" appended. 124*4724848cSchristos 125*4724848cSchristos=item B<-cert> 126*4724848cSchristos 127*4724848cSchristosThe CA certificate file. 128*4724848cSchristos 129*4724848cSchristos=item B<-keyfile filename> 130*4724848cSchristos 131*4724848cSchristosThe private key to sign requests with. 132*4724848cSchristos 133*4724848cSchristos=item B<-keyform PEM|DER> 134*4724848cSchristos 135*4724848cSchristosThe format of the data in the private key file. 136*4724848cSchristosThe default is PEM. 137*4724848cSchristos 138*4724848cSchristos=item B<-sigopt nm:v> 139*4724848cSchristos 140*4724848cSchristosPass options to the signature algorithm during sign or verify operations. 141*4724848cSchristosNames and values of these options are algorithm-specific. 142*4724848cSchristos 143*4724848cSchristos=item B<-key password> 144*4724848cSchristos 145*4724848cSchristosThe password used to encrypt the private key. Since on some 146*4724848cSchristossystems the command line arguments are visible (e.g. Unix with 147*4724848cSchristosthe 'ps' utility) this option should be used with caution. 148*4724848cSchristos 149*4724848cSchristos=item B<-selfsign> 150*4724848cSchristos 151*4724848cSchristosIndicates the issued certificates are to be signed with the key 152*4724848cSchristosthe certificate requests were signed with (given with B<-keyfile>). 153*4724848cSchristosCertificate requests signed with a different key are ignored. If 154*4724848cSchristosB<-spkac>, B<-ss_cert> or B<-gencrl> are given, B<-selfsign> is 155*4724848cSchristosignored. 156*4724848cSchristos 157*4724848cSchristosA consequence of using B<-selfsign> is that the self-signed 158*4724848cSchristoscertificate appears among the entries in the certificate database 159*4724848cSchristos(see the configuration option B<database>), and uses the same 160*4724848cSchristosserial number counter as all other certificates sign with the 161*4724848cSchristosself-signed certificate. 162*4724848cSchristos 163*4724848cSchristos=item B<-passin arg> 164*4724848cSchristos 165*4724848cSchristosThe key password source. For more information about the format of B<arg> 166*4724848cSchristossee L<openssl(1)/Pass Phrase Options>. 167*4724848cSchristos 168*4724848cSchristos=item B<-notext> 169*4724848cSchristos 170*4724848cSchristosDon't output the text form of a certificate to the output file. 171*4724848cSchristos 172*4724848cSchristos=item B<-startdate date> 173*4724848cSchristos 174*4724848cSchristosThis allows the start date to be explicitly set. The format of the 175*4724848cSchristosdate is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or 176*4724848cSchristosYYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In 177*4724848cSchristosboth formats, seconds SS and timezone Z must be present. 178*4724848cSchristos 179*4724848cSchristos=item B<-enddate date> 180*4724848cSchristos 181*4724848cSchristosThis allows the expiry date to be explicitly set. The format of the 182*4724848cSchristosdate is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or 183*4724848cSchristosYYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In 184*4724848cSchristosboth formats, seconds SS and timezone Z must be present. 185*4724848cSchristos 186*4724848cSchristos=item B<-days arg> 187*4724848cSchristos 188*4724848cSchristosThe number of days to certify the certificate for. 189*4724848cSchristos 190*4724848cSchristos=item B<-md alg> 191*4724848cSchristos 192*4724848cSchristosThe message digest to use. 193*4724848cSchristosAny digest supported by the OpenSSL B<dgst> command can be used. For signing 194*4724848cSchristosalgorithms that do not support a digest (i.e. Ed25519 and Ed448) any message 195*4724848cSchristosdigest that is set is ignored. This option also applies to CRLs. 196*4724848cSchristos 197*4724848cSchristos=item B<-policy arg> 198*4724848cSchristos 199*4724848cSchristosThis option defines the CA "policy" to use. This is a section in 200*4724848cSchristosthe configuration file which decides which fields should be mandatory 201*4724848cSchristosor match the CA certificate. Check out the B<POLICY FORMAT> section 202*4724848cSchristosfor more information. 203*4724848cSchristos 204*4724848cSchristos=item B<-msie_hack> 205*4724848cSchristos 206*4724848cSchristosThis is a deprecated option to make B<ca> work with very old versions of 207*4724848cSchristosthe IE certificate enrollment control "certenr3". It used UniversalStrings 208*4724848cSchristosfor almost everything. Since the old control has various security bugs 209*4724848cSchristosits use is strongly discouraged. 210*4724848cSchristos 211*4724848cSchristos=item B<-preserveDN> 212*4724848cSchristos 213*4724848cSchristosNormally the DN order of a certificate is the same as the order of the 214*4724848cSchristosfields in the relevant policy section. When this option is set the order 215*4724848cSchristosis the same as the request. This is largely for compatibility with the 216*4724848cSchristosolder IE enrollment control which would only accept certificates if their 217*4724848cSchristosDNs match the order of the request. This is not needed for Xenroll. 218*4724848cSchristos 219*4724848cSchristos=item B<-noemailDN> 220*4724848cSchristos 221*4724848cSchristosThe DN of a certificate can contain the EMAIL field if present in the 222*4724848cSchristosrequest DN, however, it is good policy just having the e-mail set into 223*4724848cSchristosthe altName extension of the certificate. When this option is set the 224*4724848cSchristosEMAIL field is removed from the certificate' subject and set only in 225*4724848cSchristosthe, eventually present, extensions. The B<email_in_dn> keyword can be 226*4724848cSchristosused in the configuration file to enable this behaviour. 227*4724848cSchristos 228*4724848cSchristos=item B<-batch> 229*4724848cSchristos 230*4724848cSchristosThis sets the batch mode. In this mode no questions will be asked 231*4724848cSchristosand all certificates will be certified automatically. 232*4724848cSchristos 233*4724848cSchristos=item B<-extensions section> 234*4724848cSchristos 235*4724848cSchristosThe section of the configuration file containing certificate extensions 236*4724848cSchristosto be added when a certificate is issued (defaults to B<x509_extensions> 237*4724848cSchristosunless the B<-extfile> option is used). If no extension section is 238*4724848cSchristospresent then, a V1 certificate is created. If the extension section 239*4724848cSchristosis present (even if it is empty), then a V3 certificate is created. See the 240*4724848cSchristosL<x509v3_config(5)> manual page for details of the 241*4724848cSchristosextension section format. 242*4724848cSchristos 243*4724848cSchristos=item B<-extfile file> 244*4724848cSchristos 245*4724848cSchristosAn additional configuration file to read certificate extensions from 246*4724848cSchristos(using the default section unless the B<-extensions> option is also 247*4724848cSchristosused). 248*4724848cSchristos 249*4724848cSchristos=item B<-engine id> 250*4724848cSchristos 251*4724848cSchristosSpecifying an engine (by its unique B<id> string) will cause B<ca> 252*4724848cSchristosto attempt to obtain a functional reference to the specified engine, 253*4724848cSchristosthus initialising it if needed. The engine will then be set as the default 254*4724848cSchristosfor all available algorithms. 255*4724848cSchristos 256*4724848cSchristos=item B<-subj arg> 257*4724848cSchristos 258*4724848cSchristosSupersedes subject name given in the request. 259*4724848cSchristosThe arg must be formatted as I</type0=value0/type1=value1/type2=...>. 260*4724848cSchristosKeyword characters may be escaped by \ (backslash), and whitespace is retained. 261*4724848cSchristosEmpty values are permitted, but the corresponding type will not be included 262*4724848cSchristosin the resulting certificate. 263*4724848cSchristos 264*4724848cSchristos=item B<-utf8> 265*4724848cSchristos 266*4724848cSchristosThis option causes field values to be interpreted as UTF8 strings, by 267*4724848cSchristosdefault they are interpreted as ASCII. This means that the field 268*4724848cSchristosvalues, whether prompted from a terminal or obtained from a 269*4724848cSchristosconfiguration file, must be valid UTF8 strings. 270*4724848cSchristos 271*4724848cSchristos=item B<-create_serial> 272*4724848cSchristos 273*4724848cSchristosIf reading serial from the text file as specified in the configuration 274*4724848cSchristosfails, specifying this option creates a new random serial to be used as next 275*4724848cSchristosserial number. 276*4724848cSchristosTo get random serial numbers, use the B<-rand_serial> flag instead; this 277*4724848cSchristosshould only be used for simple error-recovery. 278*4724848cSchristos 279*4724848cSchristos=item B<-rand_serial> 280*4724848cSchristos 281*4724848cSchristosGenerate a large random number to use as the serial number. 282*4724848cSchristosThis overrides any option or configuration to use a serial number file. 283*4724848cSchristos 284*4724848cSchristos=item B<-multivalue-rdn> 285*4724848cSchristos 286*4724848cSchristosThis option causes the -subj argument to be interpreted with full 287*4724848cSchristossupport for multivalued RDNs. Example: 288*4724848cSchristos 289*4724848cSchristosI</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe> 290*4724848cSchristos 291*4724848cSchristosIf -multi-rdn is not used then the UID value is I<123456+CN=John Doe>. 292*4724848cSchristos 293*4724848cSchristos=item B<-rand file...> 294*4724848cSchristos 295*4724848cSchristosA file or files containing random data used to seed the random number 296*4724848cSchristosgenerator. 297*4724848cSchristosMultiple files can be specified separated by an OS-dependent character. 298*4724848cSchristosThe separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for 299*4724848cSchristosall others. 300*4724848cSchristos 301*4724848cSchristos=item [B<-writerand file>] 302*4724848cSchristos 303*4724848cSchristosWrites random data to the specified I<file> upon exit. 304*4724848cSchristosThis can be used with a subsequent B<-rand> flag. 305*4724848cSchristos 306*4724848cSchristos=back 307*4724848cSchristos 308*4724848cSchristos=head1 CRL OPTIONS 309*4724848cSchristos 310*4724848cSchristos=over 4 311*4724848cSchristos 312*4724848cSchristos=item B<-gencrl> 313*4724848cSchristos 314*4724848cSchristosThis option generates a CRL based on information in the index file. 315*4724848cSchristos 316*4724848cSchristos=item B<-crldays num> 317*4724848cSchristos 318*4724848cSchristosThe number of days before the next CRL is due. That is the days from 319*4724848cSchristosnow to place in the CRL nextUpdate field. 320*4724848cSchristos 321*4724848cSchristos=item B<-crlhours num> 322*4724848cSchristos 323*4724848cSchristosThe number of hours before the next CRL is due. 324*4724848cSchristos 325*4724848cSchristos=item B<-revoke filename> 326*4724848cSchristos 327*4724848cSchristosA filename containing a certificate to revoke. 328*4724848cSchristos 329*4724848cSchristos=item B<-valid filename> 330*4724848cSchristos 331*4724848cSchristosA filename containing a certificate to add a Valid certificate entry. 332*4724848cSchristos 333*4724848cSchristos=item B<-status serial> 334*4724848cSchristos 335*4724848cSchristosDisplays the revocation status of the certificate with the specified 336*4724848cSchristosserial number and exits. 337*4724848cSchristos 338*4724848cSchristos=item B<-updatedb> 339*4724848cSchristos 340*4724848cSchristosUpdates the database index to purge expired certificates. 341*4724848cSchristos 342*4724848cSchristos=item B<-crl_reason reason> 343*4724848cSchristos 344*4724848cSchristosRevocation reason, where B<reason> is one of: B<unspecified>, B<keyCompromise>, 345*4724848cSchristosB<CACompromise>, B<affiliationChanged>, B<superseded>, B<cessationOfOperation>, 346*4724848cSchristosB<certificateHold> or B<removeFromCRL>. The matching of B<reason> is case 347*4724848cSchristosinsensitive. Setting any revocation reason will make the CRL v2. 348*4724848cSchristos 349*4724848cSchristosIn practice B<removeFromCRL> is not particularly useful because it is only used 350*4724848cSchristosin delta CRLs which are not currently implemented. 351*4724848cSchristos 352*4724848cSchristos=item B<-crl_hold instruction> 353*4724848cSchristos 354*4724848cSchristosThis sets the CRL revocation reason code to B<certificateHold> and the hold 355*4724848cSchristosinstruction to B<instruction> which must be an OID. Although any OID can be 356*4724848cSchristosused only B<holdInstructionNone> (the use of which is discouraged by RFC2459) 357*4724848cSchristosB<holdInstructionCallIssuer> or B<holdInstructionReject> will normally be used. 358*4724848cSchristos 359*4724848cSchristos=item B<-crl_compromise time> 360*4724848cSchristos 361*4724848cSchristosThis sets the revocation reason to B<keyCompromise> and the compromise time to 362*4724848cSchristosB<time>. B<time> should be in GeneralizedTime format that is B<YYYYMMDDHHMMSSZ>. 363*4724848cSchristos 364*4724848cSchristos=item B<-crl_CA_compromise time> 365*4724848cSchristos 366*4724848cSchristosThis is the same as B<crl_compromise> except the revocation reason is set to 367*4724848cSchristosB<CACompromise>. 368*4724848cSchristos 369*4724848cSchristos=item B<-crlexts section> 370*4724848cSchristos 371*4724848cSchristosThe section of the configuration file containing CRL extensions to 372*4724848cSchristosinclude. If no CRL extension section is present then a V1 CRL is 373*4724848cSchristoscreated, if the CRL extension section is present (even if it is 374*4724848cSchristosempty) then a V2 CRL is created. The CRL extensions specified are 375*4724848cSchristosCRL extensions and B<not> CRL entry extensions. It should be noted 376*4724848cSchristosthat some software (for example Netscape) can't handle V2 CRLs. See 377*4724848cSchristosL<x509v3_config(5)> manual page for details of the 378*4724848cSchristosextension section format. 379*4724848cSchristos 380*4724848cSchristos=back 381*4724848cSchristos 382*4724848cSchristos=head1 CONFIGURATION FILE OPTIONS 383*4724848cSchristos 384*4724848cSchristosThe section of the configuration file containing options for B<ca> 385*4724848cSchristosis found as follows: If the B<-name> command line option is used, 386*4724848cSchristosthen it names the section to be used. Otherwise the section to 387*4724848cSchristosbe used must be named in the B<default_ca> option of the B<ca> section 388*4724848cSchristosof the configuration file (or in the default section of the 389*4724848cSchristosconfiguration file). Besides B<default_ca>, the following options are 390*4724848cSchristosread directly from the B<ca> section: 391*4724848cSchristos RANDFILE 392*4724848cSchristos preserve 393*4724848cSchristos msie_hack 394*4724848cSchristosWith the exception of B<RANDFILE>, this is probably a bug and may 395*4724848cSchristoschange in future releases. 396*4724848cSchristos 397*4724848cSchristosMany of the configuration file options are identical to command line 398*4724848cSchristosoptions. Where the option is present in the configuration file 399*4724848cSchristosand the command line the command line value is used. Where an 400*4724848cSchristosoption is described as mandatory then it must be present in 401*4724848cSchristosthe configuration file or the command line equivalent (if 402*4724848cSchristosany) used. 403*4724848cSchristos 404*4724848cSchristos=over 4 405*4724848cSchristos 406*4724848cSchristos=item B<oid_file> 407*4724848cSchristos 408*4724848cSchristosThis specifies a file containing additional B<OBJECT IDENTIFIERS>. 409*4724848cSchristosEach line of the file should consist of the numerical form of the 410*4724848cSchristosobject identifier followed by white space then the short name followed 411*4724848cSchristosby white space and finally the long name. 412*4724848cSchristos 413*4724848cSchristos=item B<oid_section> 414*4724848cSchristos 415*4724848cSchristosThis specifies a section in the configuration file containing extra 416*4724848cSchristosobject identifiers. Each line should consist of the short name of the 417*4724848cSchristosobject identifier followed by B<=> and the numerical form. The short 418*4724848cSchristosand long names are the same when this option is used. 419*4724848cSchristos 420*4724848cSchristos=item B<new_certs_dir> 421*4724848cSchristos 422*4724848cSchristosThe same as the B<-outdir> command line option. It specifies 423*4724848cSchristosthe directory where new certificates will be placed. Mandatory. 424*4724848cSchristos 425*4724848cSchristos=item B<certificate> 426*4724848cSchristos 427*4724848cSchristosThe same as B<-cert>. It gives the file containing the CA 428*4724848cSchristoscertificate. Mandatory. 429*4724848cSchristos 430*4724848cSchristos=item B<private_key> 431*4724848cSchristos 432*4724848cSchristosSame as the B<-keyfile> option. The file containing the 433*4724848cSchristosCA private key. Mandatory. 434*4724848cSchristos 435*4724848cSchristos=item B<RANDFILE> 436*4724848cSchristos 437*4724848cSchristosAt startup the specified file is loaded into the random number generator, 438*4724848cSchristosand at exit 256 bytes will be written to it. 439*4724848cSchristos 440*4724848cSchristos=item B<default_days> 441*4724848cSchristos 442*4724848cSchristosThe same as the B<-days> option. The number of days to certify 443*4724848cSchristosa certificate for. 444*4724848cSchristos 445*4724848cSchristos=item B<default_startdate> 446*4724848cSchristos 447*4724848cSchristosThe same as the B<-startdate> option. The start date to certify 448*4724848cSchristosa certificate for. If not set the current time is used. 449*4724848cSchristos 450*4724848cSchristos=item B<default_enddate> 451*4724848cSchristos 452*4724848cSchristosThe same as the B<-enddate> option. Either this option or 453*4724848cSchristosB<default_days> (or the command line equivalents) must be 454*4724848cSchristospresent. 455*4724848cSchristos 456*4724848cSchristos=item B<default_crl_hours default_crl_days> 457*4724848cSchristos 458*4724848cSchristosThe same as the B<-crlhours> and the B<-crldays> options. These 459*4724848cSchristoswill only be used if neither command line option is present. At 460*4724848cSchristosleast one of these must be present to generate a CRL. 461*4724848cSchristos 462*4724848cSchristos=item B<default_md> 463*4724848cSchristos 464*4724848cSchristosThe same as the B<-md> option. Mandatory except where the signing algorithm does 465*4724848cSchristosnot require a digest (i.e. Ed25519 and Ed448). 466*4724848cSchristos 467*4724848cSchristos=item B<database> 468*4724848cSchristos 469*4724848cSchristosThe text database file to use. Mandatory. This file must be present 470*4724848cSchristosthough initially it will be empty. 471*4724848cSchristos 472*4724848cSchristos=item B<unique_subject> 473*4724848cSchristos 474*4724848cSchristosIf the value B<yes> is given, the valid certificate entries in the 475*4724848cSchristosdatabase must have unique subjects. if the value B<no> is given, 476*4724848cSchristosseveral valid certificate entries may have the exact same subject. 477*4724848cSchristosThe default value is B<yes>, to be compatible with older (pre 0.9.8) 478*4724848cSchristosversions of OpenSSL. However, to make CA certificate roll-over easier, 479*4724848cSchristosit's recommended to use the value B<no>, especially if combined with 480*4724848cSchristosthe B<-selfsign> command line option. 481*4724848cSchristos 482*4724848cSchristosNote that it is valid in some circumstances for certificates to be created 483*4724848cSchristoswithout any subject. In the case where there are multiple certificates without 484*4724848cSchristossubjects this does not count as a duplicate. 485*4724848cSchristos 486*4724848cSchristos=item B<serial> 487*4724848cSchristos 488*4724848cSchristosA text file containing the next serial number to use in hex. Mandatory. 489*4724848cSchristosThis file must be present and contain a valid serial number. 490*4724848cSchristos 491*4724848cSchristos=item B<crlnumber> 492*4724848cSchristos 493*4724848cSchristosA text file containing the next CRL number to use in hex. The crl number 494*4724848cSchristoswill be inserted in the CRLs only if this file exists. If this file is 495*4724848cSchristospresent, it must contain a valid CRL number. 496*4724848cSchristos 497*4724848cSchristos=item B<x509_extensions> 498*4724848cSchristos 499*4724848cSchristosThe same as B<-extensions>. 500*4724848cSchristos 501*4724848cSchristos=item B<crl_extensions> 502*4724848cSchristos 503*4724848cSchristosThe same as B<-crlexts>. 504*4724848cSchristos 505*4724848cSchristos=item B<preserve> 506*4724848cSchristos 507*4724848cSchristosThe same as B<-preserveDN> 508*4724848cSchristos 509*4724848cSchristos=item B<email_in_dn> 510*4724848cSchristos 511*4724848cSchristosThe same as B<-noemailDN>. If you want the EMAIL field to be removed 512*4724848cSchristosfrom the DN of the certificate simply set this to 'no'. If not present 513*4724848cSchristosthe default is to allow for the EMAIL filed in the certificate's DN. 514*4724848cSchristos 515*4724848cSchristos=item B<msie_hack> 516*4724848cSchristos 517*4724848cSchristosThe same as B<-msie_hack> 518*4724848cSchristos 519*4724848cSchristos=item B<policy> 520*4724848cSchristos 521*4724848cSchristosThe same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section 522*4724848cSchristosfor more information. 523*4724848cSchristos 524*4724848cSchristos=item B<name_opt>, B<cert_opt> 525*4724848cSchristos 526*4724848cSchristosThese options allow the format used to display the certificate details 527*4724848cSchristoswhen asking the user to confirm signing. All the options supported by 528*4724848cSchristosthe B<x509> utilities B<-nameopt> and B<-certopt> switches can be used 529*4724848cSchristoshere, except the B<no_signame> and B<no_sigdump> are permanently set 530*4724848cSchristosand cannot be disabled (this is because the certificate signature cannot 531*4724848cSchristosbe displayed because the certificate has not been signed at this point). 532*4724848cSchristos 533*4724848cSchristosFor convenience the values B<ca_default> are accepted by both to produce 534*4724848cSchristosa reasonable output. 535*4724848cSchristos 536*4724848cSchristosIf neither option is present the format used in earlier versions of 537*4724848cSchristosOpenSSL is used. Use of the old format is B<strongly> discouraged because 538*4724848cSchristosit only displays fields mentioned in the B<policy> section, mishandles 539*4724848cSchristosmulticharacter string types and does not display extensions. 540*4724848cSchristos 541*4724848cSchristos=item B<copy_extensions> 542*4724848cSchristos 543*4724848cSchristosDetermines how extensions in certificate requests should be handled. 544*4724848cSchristosIf set to B<none> or this option is not present then extensions are 545*4724848cSchristosignored and not copied to the certificate. If set to B<copy> then any 546*4724848cSchristosextensions present in the request that are not already present are copied 547*4724848cSchristosto the certificate. If set to B<copyall> then all extensions in the 548*4724848cSchristosrequest are copied to the certificate: if the extension is already present 549*4724848cSchristosin the certificate it is deleted first. See the B<WARNINGS> section before 550*4724848cSchristosusing this option. 551*4724848cSchristos 552*4724848cSchristosThe main use of this option is to allow a certificate request to supply 553*4724848cSchristosvalues for certain extensions such as subjectAltName. 554*4724848cSchristos 555*4724848cSchristos=back 556*4724848cSchristos 557*4724848cSchristos=head1 POLICY FORMAT 558*4724848cSchristos 559*4724848cSchristosThe policy section consists of a set of variables corresponding to 560*4724848cSchristoscertificate DN fields. If the value is "match" then the field value 561*4724848cSchristosmust match the same field in the CA certificate. If the value is 562*4724848cSchristos"supplied" then it must be present. If the value is "optional" then 563*4724848cSchristosit may be present. Any fields not mentioned in the policy section 564*4724848cSchristosare silently deleted, unless the B<-preserveDN> option is set but 565*4724848cSchristosthis can be regarded more of a quirk than intended behaviour. 566*4724848cSchristos 567*4724848cSchristos=head1 SPKAC FORMAT 568*4724848cSchristos 569*4724848cSchristosThe input to the B<-spkac> command line option is a Netscape 570*4724848cSchristossigned public key and challenge. This will usually come from 571*4724848cSchristosthe B<KEYGEN> tag in an HTML form to create a new private key. 572*4724848cSchristosIt is however possible to create SPKACs using the B<spkac> utility. 573*4724848cSchristos 574*4724848cSchristosThe file should contain the variable SPKAC set to the value of 575*4724848cSchristosthe SPKAC and also the required DN components as name value pairs. 576*4724848cSchristosIf you need to include the same component twice then it can be 577*4724848cSchristospreceded by a number and a '.'. 578*4724848cSchristos 579*4724848cSchristosWhen processing SPKAC format, the output is DER if the B<-out> 580*4724848cSchristosflag is used, but PEM format if sending to stdout or the B<-outdir> 581*4724848cSchristosflag is used. 582*4724848cSchristos 583*4724848cSchristos=head1 EXAMPLES 584*4724848cSchristos 585*4724848cSchristosNote: these examples assume that the B<ca> directory structure is 586*4724848cSchristosalready set up and the relevant files already exist. This usually 587*4724848cSchristosinvolves creating a CA certificate and private key with B<req>, a 588*4724848cSchristosserial number file and an empty index file and placing them in 589*4724848cSchristosthe relevant directories. 590*4724848cSchristos 591*4724848cSchristosTo use the sample configuration file below the directories demoCA, 592*4724848cSchristosdemoCA/private and demoCA/newcerts would be created. The CA 593*4724848cSchristoscertificate would be copied to demoCA/cacert.pem and its private 594*4724848cSchristoskey to demoCA/private/cakey.pem. A file demoCA/serial would be 595*4724848cSchristoscreated containing for example "01" and the empty index file 596*4724848cSchristosdemoCA/index.txt. 597*4724848cSchristos 598*4724848cSchristos 599*4724848cSchristosSign a certificate request: 600*4724848cSchristos 601*4724848cSchristos openssl ca -in req.pem -out newcert.pem 602*4724848cSchristos 603*4724848cSchristosSign a certificate request, using CA extensions: 604*4724848cSchristos 605*4724848cSchristos openssl ca -in req.pem -extensions v3_ca -out newcert.pem 606*4724848cSchristos 607*4724848cSchristosGenerate a CRL 608*4724848cSchristos 609*4724848cSchristos openssl ca -gencrl -out crl.pem 610*4724848cSchristos 611*4724848cSchristosSign several requests: 612*4724848cSchristos 613*4724848cSchristos openssl ca -infiles req1.pem req2.pem req3.pem 614*4724848cSchristos 615*4724848cSchristosCertify a Netscape SPKAC: 616*4724848cSchristos 617*4724848cSchristos openssl ca -spkac spkac.txt 618*4724848cSchristos 619*4724848cSchristosA sample SPKAC file (the SPKAC line has been truncated for clarity): 620*4724848cSchristos 621*4724848cSchristos SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5 622*4724848cSchristos CN=Steve Test 623*4724848cSchristos emailAddress=steve@openssl.org 624*4724848cSchristos 0.OU=OpenSSL Group 625*4724848cSchristos 1.OU=Another Group 626*4724848cSchristos 627*4724848cSchristosA sample configuration file with the relevant sections for B<ca>: 628*4724848cSchristos 629*4724848cSchristos [ ca ] 630*4724848cSchristos default_ca = CA_default # The default ca section 631*4724848cSchristos 632*4724848cSchristos [ CA_default ] 633*4724848cSchristos 634*4724848cSchristos dir = ./demoCA # top dir 635*4724848cSchristos database = $dir/index.txt # index file. 636*4724848cSchristos new_certs_dir = $dir/newcerts # new certs dir 637*4724848cSchristos 638*4724848cSchristos certificate = $dir/cacert.pem # The CA cert 639*4724848cSchristos serial = $dir/serial # serial no file 640*4724848cSchristos #rand_serial = yes # for random serial#'s 641*4724848cSchristos private_key = $dir/private/cakey.pem# CA private key 642*4724848cSchristos RANDFILE = $dir/private/.rand # random number file 643*4724848cSchristos 644*4724848cSchristos default_days = 365 # how long to certify for 645*4724848cSchristos default_crl_days= 30 # how long before next CRL 646*4724848cSchristos default_md = md5 # md to use 647*4724848cSchristos 648*4724848cSchristos policy = policy_any # default policy 649*4724848cSchristos email_in_dn = no # Don't add the email into cert DN 650*4724848cSchristos 651*4724848cSchristos name_opt = ca_default # Subject name display option 652*4724848cSchristos cert_opt = ca_default # Certificate display option 653*4724848cSchristos copy_extensions = none # Don't copy extensions from request 654*4724848cSchristos 655*4724848cSchristos [ policy_any ] 656*4724848cSchristos countryName = supplied 657*4724848cSchristos stateOrProvinceName = optional 658*4724848cSchristos organizationName = optional 659*4724848cSchristos organizationalUnitName = optional 660*4724848cSchristos commonName = supplied 661*4724848cSchristos emailAddress = optional 662*4724848cSchristos 663*4724848cSchristos=head1 FILES 664*4724848cSchristos 665*4724848cSchristosNote: the location of all files can change either by compile time options, 666*4724848cSchristosconfiguration file entries, environment variables or command line options. 667*4724848cSchristosThe values below reflect the default values. 668*4724848cSchristos 669*4724848cSchristos /usr/local/ssl/lib/openssl.cnf - master configuration file 670*4724848cSchristos ./demoCA - main CA directory 671*4724848cSchristos ./demoCA/cacert.pem - CA certificate 672*4724848cSchristos ./demoCA/private/cakey.pem - CA private key 673*4724848cSchristos ./demoCA/serial - CA serial number file 674*4724848cSchristos ./demoCA/serial.old - CA serial number backup file 675*4724848cSchristos ./demoCA/index.txt - CA text database file 676*4724848cSchristos ./demoCA/index.txt.old - CA text database backup file 677*4724848cSchristos ./demoCA/certs - certificate output file 678*4724848cSchristos ./demoCA/.rnd - CA random seed information 679*4724848cSchristos 680*4724848cSchristos=head1 RESTRICTIONS 681*4724848cSchristos 682*4724848cSchristosThe text database index file is a critical part of the process and 683*4724848cSchristosif corrupted it can be difficult to fix. It is theoretically possible 684*4724848cSchristosto rebuild the index file from all the issued certificates and a current 685*4724848cSchristosCRL: however there is no option to do this. 686*4724848cSchristos 687*4724848cSchristosV2 CRL features like delta CRLs are not currently supported. 688*4724848cSchristos 689*4724848cSchristosAlthough several requests can be input and handled at once it is only 690*4724848cSchristospossible to include one SPKAC or self-signed certificate. 691*4724848cSchristos 692*4724848cSchristos=head1 BUGS 693*4724848cSchristos 694*4724848cSchristosThe use of an in-memory text database can cause problems when large 695*4724848cSchristosnumbers of certificates are present because, as the name implies 696*4724848cSchristosthe database has to be kept in memory. 697*4724848cSchristos 698*4724848cSchristosThe B<ca> command really needs rewriting or the required functionality 699*4724848cSchristosexposed at either a command or interface level so a more friendly utility 700*4724848cSchristos(perl script or GUI) can handle things properly. The script 701*4724848cSchristosB<CA.pl> helps a little but not very much. 702*4724848cSchristos 703*4724848cSchristosAny fields in a request that are not present in a policy are silently 704*4724848cSchristosdeleted. This does not happen if the B<-preserveDN> option is used. To 705*4724848cSchristosenforce the absence of the EMAIL field within the DN, as suggested by 706*4724848cSchristosRFCs, regardless the contents of the request' subject the B<-noemailDN> 707*4724848cSchristosoption can be used. The behaviour should be more friendly and 708*4724848cSchristosconfigurable. 709*4724848cSchristos 710*4724848cSchristosCanceling some commands by refusing to certify a certificate can 711*4724848cSchristoscreate an empty file. 712*4724848cSchristos 713*4724848cSchristos=head1 WARNINGS 714*4724848cSchristos 715*4724848cSchristosThe B<ca> command is quirky and at times downright unfriendly. 716*4724848cSchristos 717*4724848cSchristosThe B<ca> utility was originally meant as an example of how to do things 718*4724848cSchristosin a CA. It was not supposed to be used as a full blown CA itself: 719*4724848cSchristosnevertheless some people are using it for this purpose. 720*4724848cSchristos 721*4724848cSchristosThe B<ca> command is effectively a single user command: no locking is 722*4724848cSchristosdone on the various files and attempts to run more than one B<ca> command 723*4724848cSchristoson the same database can have unpredictable results. 724*4724848cSchristos 725*4724848cSchristosThe B<copy_extensions> option should be used with caution. If care is 726*4724848cSchristosnot taken then it can be a security risk. For example if a certificate 727*4724848cSchristosrequest contains a basicConstraints extension with CA:TRUE and the 728*4724848cSchristosB<copy_extensions> value is set to B<copyall> and the user does not spot 729*4724848cSchristosthis when the certificate is displayed then this will hand the requester 730*4724848cSchristosa valid CA certificate. 731*4724848cSchristos 732*4724848cSchristosThis situation can be avoided by setting B<copy_extensions> to B<copy> 733*4724848cSchristosand including basicConstraints with CA:FALSE in the configuration file. 734*4724848cSchristosThen if the request contains a basicConstraints extension it will be 735*4724848cSchristosignored. 736*4724848cSchristos 737*4724848cSchristosIt is advisable to also include values for other extensions such 738*4724848cSchristosas B<keyUsage> to prevent a request supplying its own values. 739*4724848cSchristos 740*4724848cSchristosAdditional restrictions can be placed on the CA certificate itself. 741*4724848cSchristosFor example if the CA certificate has: 742*4724848cSchristos 743*4724848cSchristos basicConstraints = CA:TRUE, pathlen:0 744*4724848cSchristos 745*4724848cSchristosthen even if a certificate is issued with CA:TRUE it will not be valid. 746*4724848cSchristos 747*4724848cSchristos=head1 HISTORY 748*4724848cSchristos 749*4724848cSchristosSince OpenSSL 1.1.1, the program follows RFC5280. Specifically, 750*4724848cSchristoscertificate validity period (specified by any of B<-startdate>, 751*4724848cSchristosB<-enddate> and B<-days>) will be encoded as UTCTime if the dates are 752*4724848cSchristosearlier than year 2049 (included), and as GeneralizedTime if the dates 753*4724848cSchristosare in year 2050 or later. 754*4724848cSchristos 755*4724848cSchristos=head1 SEE ALSO 756*4724848cSchristos 757*4724848cSchristosL<req(1)>, L<spkac(1)>, L<x509(1)>, L<CA.pl(1)>, 758*4724848cSchristosL<config(5)>, L<x509v3_config(5)> 759*4724848cSchristos 760*4724848cSchristos=head1 COPYRIGHT 761*4724848cSchristos 762*4724848cSchristosCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. 763*4724848cSchristos 764*4724848cSchristosLicensed under the OpenSSL license (the "License"). You may not use 765*4724848cSchristosthis file except in compliance with the License. You can obtain a copy 766*4724848cSchristosin the file LICENSE in the source distribution or at 767*4724848cSchristosL<https://www.openssl.org/source/license.html>. 768*4724848cSchristos 769*4724848cSchristos=cut 770