📄 x509.pod
字号:
=pod=head1 NAMEx509 - Certificate display and signing utility=head1 SYNOPSISB<openssl> B<x509>[B<-inform DER|PEM|NET>][B<-outform DER|PEM|NET>][B<-keyform DER|PEM>][B<-CAform DER|PEM>][B<-CAkeyform DER|PEM>][B<-in filename>][B<-out filename>][B<-serial>][B<-hash>][B<-subject_hash>][B<-issuer_hash>][B<-subject>][B<-issuer>][B<-nameopt option>][B<-email>][B<-startdate>][B<-enddate>][B<-purpose>][B<-dates>][B<-modulus>][B<-fingerprint>][B<-alias>][B<-noout>][B<-trustout>][B<-clrtrust>][B<-clrreject>][B<-addtrust arg>][B<-addreject arg>][B<-setalias arg>][B<-days arg>][B<-set_serial n>][B<-signkey filename>][B<-x509toreq>][B<-req>][B<-CA filename>][B<-CAkey filename>][B<-CAcreateserial>][B<-CAserial filename>][B<-text>][B<-C>][B<-md2|-md5|-sha1|-mdc2>][B<-clrext>][B<-extfile filename>][B<-extensions section>][B<-engine id>]=head1 DESCRIPTIONThe B<x509> command is a multi purpose certificate utility. It can beused to display certificate information, convert certificates tovarious forms, sign certificate requests like a "mini CA" or editcertificate trust settings.Since there are a large number of options they will split up intovarious sections.=head1 OPTIONS=head2 INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS=over 4=item B<-inform DER|PEM|NET>This specifies the input format normally the command will expect an X509certificate but this can change if other options such as B<-req> arepresent. The DER format is the DER encoding of the certificate and PEMis the base64 encoding of the DER encoding with header and footer linesadded. The NET option is an obscure Netscape server format that is nowobsolete.=item B<-outform DER|PEM|NET>This specifies the output format, the options have the same meaning as the B<-inform> option.=item B<-in filename>This specifies the input filename to read a certificate from or standard inputif this option is not specified.=item B<-out filename>This specifies the output filename to write to or standard output bydefault.=item B<-md2|-md5|-sha1|-mdc2>the digest to use. This affects any signing or display option that uses a messagedigest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options. If notspecified then SHA1 is used. If the key being used to sign with is a DSA keythen this option has no effect: SHA1 is always used with DSA keys.=item B<-engine id>specifying an engine (by it's unique B<id> string) will cause B<req>to attempt to obtain a functional reference to the specified engine,thus initialising it if needed. The engine will then be set as the defaultfor all available algorithms.=back=head2 DISPLAY OPTIONSNote: the B<-alias> and B<-purpose> options are also display optionsbut are described in the B<TRUST SETTINGS> section.=over 4=item B<-text>prints out the certificate in text form. Full details are output including thepublic key, signature algorithms, issuer and subject names, serial numberany extensions present and any trust settings.=item B<-certopt option>customise the output format used with B<-text>. The B<option> argument can bea single option or multiple options separated by commas. The B<-certopt> switchmay be also be used more than once to set multiple options. See the B<TEXT OPTIONS>section for more information.=item B<-noout>this option prevents output of the encoded version of the request.=item B<-modulus>this option prints out the value of the modulus of the public keycontained in the certificate.=item B<-serial>outputs the certificate serial number.=item B<-subject_hash>outputs the "hash" of the certificate subject name. This is used in OpenSSL toform an index to allow certificates in a directory to be looked up by subjectname.=item B<-issuer_hash>outputs the "hash" of the certificate issuer name.=item B<-hash>synonym for "-hash" for backward compatibility reasons.=item B<-subject>outputs the subject name.=item B<-issuer>outputs the issuer name.=item B<-nameopt option>option which determines how the subject or issuer names are displayed. TheB<option> argument can be a single option or multiple options separated bycommas. Alternatively the B<-nameopt> switch may be used more than once toset multiple options. See the B<NAME OPTIONS> section for more information.=item B<-email>outputs the email address(es) if any.=item B<-startdate>prints out the start date of the certificate, that is the notBefore date.=item B<-enddate>prints out the expiry date of the certificate, that is the notAfter date.=item B<-dates>prints out the start and expiry dates of a certificate.=item B<-fingerprint>prints out the digest of the DER encoded version of the whole certificate(see digest options).=item B<-C>this outputs the certificate in the form of a C source file.=back=head2 TRUST SETTINGSPlease note these options are currently experimental and may well change.A B<trusted certificate> is an ordinary certificate which has severaladditional pieces of information attached to it such as the permittedand prohibited uses of the certificate and an "alias".Normally when a certificate is being verified at least one certificatemust be "trusted". By default a trusted certificate must be storedlocally and must be a root CA: any certificate chain ending in this CAis then usable for any purpose.Trust settings currently are only used with a root CA. They allow a finercontrol over the purposes the root CA can be used for. For example a CAmay be trusted for SSL client but not SSL server use.See the description of the B<verify> utility for more information on themeaning of trust settings.Future versions of OpenSSL will recognize trust settings on anycertificate: not just root CAs.=over 4=item B<-trustout>this causes B<x509> to output a B<trusted> certificate. An ordinaryor trusted certificate can be input but by default an ordinarycertificate is output and any trust settings are discarded. With theB<-trustout> option a trusted certificate is output. A trustedcertificate is automatically output if any trust settings are modified.=item B<-setalias arg>sets the alias of the certificate. This will allow the certificateto be referred to using a nickname for example "Steve's Certificate".=item B<-alias>outputs the certificate alias, if any.=item B<-clrtrust>clears all the permitted or trusted uses of the certificate.=item B<-clrreject>clears all the prohibited or rejected uses of the certificate.=item B<-addtrust arg>adds a trusted certificate use. Any object name can be used herebut currently only B<clientAuth> (SSL client use), B<serverAuth>(SSL server use) and B<emailProtection> (S/MIME email) are used.Other OpenSSL applications may define additional uses.=item B<-addreject arg>adds a prohibited use. It accepts the same values as the B<-addtrust>option.=item B<-purpose>this option performs tests on the certificate extensions and outputsthe results. For a more complete description see the B<CERTIFICATEEXTENSIONS> section.=back=head2 SIGNING OPTIONSThe B<x509> utility can be used to sign certificates and requests: itcan thus behave like a "mini CA".=over 4=item B<-signkey filename>this option causes the input file to be self signed using the suppliedprivate key. If the input file is a certificate it sets the issuer name to thesubject name (i.e. makes it self signed) changes the public key to thesupplied value and changes the start and end dates. The start date isset to the current time and the end date is set to a value determinedby the B<-days> option. Any certificate extensions are retained unlessthe B<-clrext> option is supplied.If the input is a certificate request then a self signed certificateis created using the supplied private key using the subject name inthe request.=item B<-clrext>delete any extensions from a certificate. This option is used when acertificate is being created from another certificate (for example withthe B<-signkey> or the B<-CA> options). Normally all extensions areretained.=item B<-keyform PEM|DER>specifies the format (DER or PEM) of the private key file used in theB<-signkey> option.=item B<-days arg>specifies the number of days to make a certificate valid for. The defaultis 30 days.=item B<-x509toreq>converts a certificate into a certificate request. The B<-signkey> optionis used to pass the required private key.=item B<-req>by default a certificate is expected on input. With this option acertificate request is expected instead.=item B<-set_serial n>specifies the serial number to use. This option can be used with eitherthe B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA>option the serial number file (as specified by the B<-CAserial> orB<-CAcreateserial> options) is not used.The serial number can be decimal or hex (if preceded by B<0x>). Negativeserial numbers can also be specified but their use is not recommended.=item B<-CA filename>specifies the CA certificate to be used for signing. When this option ispresent B<x509> behaves like a "mini CA". The input file is signed by thisCA using this option: that is its issuer name is set to the subject nameof the CA and it is digitally signed using the CAs private key.This option is normally combined with the B<-req> option. Without theB<-req> option the input is a certificate which must be self signed.=item B<-CAkey filename>sets the CA private key to sign a certificate with. If this option isnot specified then it is assumed that the CA private key is present inthe CA certificate file.=item B<-CAserial filename>sets the CA serial number file to use.When the B<-CA> option is used to sign a certificate it uses a serialnumber specified in a file. This file consist of one line containingan even number of hex digits with the serial number to use. After eachuse the serial number is incremented and written out to the file again.The default filename consists of the CA certificate file base name with".srl" appended. For example if the CA certificate file is called "mycacert.pem" it expects to find a serial number file called "mycacert.srl".=item B<-CAcreateserial>with this option the CA serial number file is created if it does not exist:it will contain the serial number "02" and the certificate being signed willhave the 1 as its serial number. Normally if the B<-CA> option is specifiedand the serial number file does not exist it is an error.=item B<-extfile filename>file containing certificate extensions to use. If not specified thenno extensions are added to the certificate.=item B<-extensions section>the section to add certificate extensions from. If this option is notspecified then the extensions should either be contained in the unnamed(default) section or the default section should contain a variable called"extensions" which contains the section to use.=back=head2 NAME OPTIONSThe B<nameopt> command line switch determines how the subject and issuernames are displayed. If no B<nameopt> switch is present the default "oneline"format is used which is compatible with previous versions of OpenSSL.Each option is described in detail below, all options can be preceded bya B<-> to turn the option off. Only the first four will normally be used.=over 4=item B<compat>use the old format. This is equivalent to specifying no name options at all.=item B<RFC2253>displays names compatible with RFC2253 equivalent to B<esc_2253>, B<esc_ctrl>,B<esc_msb>, B<utf8>, B<dump_nostr>, B<dump_unknown>, B<dump_der>,B<sep_comma_plus>, B<dn_rev> and B<sname>.=item B<oneline>a oneline format which is more readable than RFC2253. It is equivalent tospecifying the B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>, B<dump_nostr>,B<dump_der>, B<use_quote>, B<sep_comma_plus_space>, B<space_eq> and B<sname>options.=item B<multiline>a multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>,B<space_eq>, B<lname> and B<align>.=item B<esc_2253>escape the "special" characters required by RFC2253 in a field That is
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -