📄 req.pod
字号:
object identifiers. Each line should consist of the short name of theobject identifier followed by B<=> and the numerical form. The shortand long names are the same when this option is used.=item B<RANDFILE>This specifies a filename in which random number seed information isplaced and read from, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).It is used for private key generation.=item B<encrypt_key>If this is set to B<no> then if a private key is generated it isB<not> encrypted. This is equivalent to the B<-nodes> command lineoption. For compatibility B<encrypt_rsa_key> is an equivalent option.=item B<default_md>This option specifies the digest algorithm to use. Possible valuesinclude B<md5 sha1 mdc2>. If not present then MD5 is used. Thisoption can be overridden on the command line.=item B<string_mask>This option masks out the use of certain string types in certainfields. Most users will not need to change this option.It can be set to several values B<default> which is also the defaultoption uses PrintableStrings, T61Strings and BMPStrings if the B<pkix> value is used then only PrintableStrings and BMPStrings willbe used. This follows the PKIX recommendation in RFC2459. If theB<utf8only> option is used then only UTF8Strings will be used: thisis the PKIX recommendation in RFC2459 after 2003. Finally the B<nombstr>option just uses PrintableStrings and T61Strings: certain software hasproblems with BMPStrings and UTF8Strings: in particular Netscape.=item B<req_extensions>this specifies the configuration file section containing a list ofextensions to add to the certificate request. It can be overriddenby the B<-reqexts> command line switch.=item B<x509_extensions>this specifies the configuration file section containing a list ofextensions to add to certificate generated when the B<-x509> switchis used. It can be overridden by the B<-extensions> command line switch.=item B<prompt>if set to the value B<no> this disables prompting of certificate fieldsand just takes values from the config file directly. It also changes theexpected format of the B<distinguished_name> and B<attributes> sections.=item B<utf8>if set to the value B<yes> then field values to be interpreted as UTF8strings, by default they are interpreted as ASCII. This means thatthe field values, whether prompted from a terminal or obtained from aconfiguration file, must be valid UTF8 strings.=item B<attributes>this specifies the section containing any request attributes: its formatis the same as B<distinguished_name>. Typically these may contain thechallengePassword or unstructuredName types. They are currently ignoredby OpenSSL's request signing utilities but some CAs might want them.=item B<distinguished_name>This specifies the section containing the distinguished name fields toprompt for when generating a certificate or certificate request. The formatis described in the next section.=back=head1 DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMATThere are two separate formats for the distinguished name and attributesections. If the B<prompt> option is set to B<no> then these sectionsjust consist of field names and values: for example, CN=My Name OU=My Organization emailAddress=someone@somewhere.orgThis allows external programs (e.g. GUI based) to generate a template filewith all the field names and values and just pass it to B<req>. An exampleof this kind of configuration file is contained in the B<EXAMPLES> section.Alternatively if the B<prompt> option is absent or not set to B<no> then thefile contains field prompting information. It consists of lines of the form: fieldName="prompt" fieldName_default="default field value" fieldName_min= 2 fieldName_max= 4"fieldName" is the field name being used, for example commonName (or CN).The "prompt" string is used to ask the user to enter the relevantdetails. If the user enters nothing then the default value is used if nodefault value is present then the field is omitted. A field canstill be omitted if a default value is present if the user justenters the '.' character.The number of characters entered must be between the fieldName_min andfieldName_max limits: there may be additional restrictions basedon the field being used (for example countryName can only ever betwo characters long and must fit in a PrintableString).Some fields (such as organizationName) can be used more than oncein a DN. This presents a problem because configuration files willnot recognize the same name occurring twice. To avoid this problemif the fieldName contains some characters followed by a full stopthey will be ignored. So for example a second organizationName canbe input by calling it "1.organizationName".The actual permitted field names are any object identifier short orlong names. These are compiled into OpenSSL and include the usualvalues such as commonName, countryName, localityName, organizationName,organizationUnitName, stateOrProvinceName. Additionally emailAddressis include as well as name, surname, givenName initials and dnQualifier.Additional object identifiers can be defined with the B<oid_file> orB<oid_section> options in the configuration file. Any additional fieldswill be treated as though they were a DirectoryString.=head1 EXAMPLESExamine and verify certificate request: openssl req -in req.pem -text -verify -nooutCreate a private key and then generate a certificate request from it: openssl genrsa -out key.pem 1024 openssl req -new -key key.pem -out req.pemThe same but just using req: openssl req -newkey rsa:1024 -keyout key.pem -out req.pemGenerate a self signed root certificate: openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pemExample of a file pointed to by the B<oid_file> option: 1.2.3.4 shortName A longer Name 1.2.3.6 otherName Other longer NameExample of a section pointed to by B<oid_section> making use of variableexpansion: testoid1=1.2.3.5 testoid2=${testoid1}.6Sample configuration file prompting for field values: [ req ] default_bits = 1024 default_keyfile = privkey.pem distinguished_name = req_distinguished_name attributes = req_attributes x509_extensions = v3_ca dirstring_type = nobmp [ req_distinguished_name ] countryName = Country Name (2 letter code) countryName_default = AU countryName_min = 2 countryName_max = 2 localityName = Locality Name (eg, city) organizationalUnitName = Organizational Unit Name (eg, section) commonName = Common Name (eg, YOUR name) commonName_max = 64 emailAddress = Email Address emailAddress_max = 40 [ req_attributes ] challengePassword = A challenge password challengePassword_min = 4 challengePassword_max = 20 [ v3_ca ] subjectKeyIdentifier=hash authorityKeyIdentifier=keyid:always,issuer:always basicConstraints = CA:trueSample configuration containing all field values: RANDFILE = $ENV::HOME/.rnd [ req ] default_bits = 1024 default_keyfile = keyfile.pem distinguished_name = req_distinguished_name attributes = req_attributes prompt = no output_password = mypass [ req_distinguished_name ] C = GB ST = Test State or Province L = Test Locality O = Organization Name OU = Organizational Unit Name CN = Common Name emailAddress = test@email.address [ req_attributes ] challengePassword = A challenge password=head1 NOTESThe header and footer lines in the B<PEM> format are normally: -----BEGIN CERTIFICATE REQUEST----- -----END CERTIFICATE REQUEST-----some software (some versions of Netscape certificate server) instead needs: -----BEGIN NEW CERTIFICATE REQUEST----- -----END NEW CERTIFICATE REQUEST-----which is produced with the B<-newhdr> option but is otherwise compatible.Either form is accepted transparently on input.The certificate requests generated by B<Xenroll> with MSIE have extensionsadded. It includes the B<keyUsage> extension which determines the type ofkey (signature only or general purpose) and any additional OIDs enteredby the script in an extendedKeyUsage extension.=head1 DIAGNOSTICSThe following messages are frequently asked about: Using configuration from /some/path/openssl.cnf Unable to load config infoThis is followed some time later by... unable to find 'distinguished_name' in config problems making Certificate RequestThe first error message is the clue: it can't find the configurationfile! Certain operations (like examining a certificate request) don'tneed a configuration file so its use isn't enforced. Generation ofcertificates or requests however does need a configuration file. Thiscould be regarded as a bug.Another puzzling message is this: Attributes: a0:00this is displayed when no attributes are present and the request includesthe correct empty B<SET OF> structure (the DER encoding of which is 0xa00x00). If you just see: Attributes:then the B<SET OF> is missing and the encoding is technically invalid (butit is tolerated). See the description of the command line option B<-asn1-kludge>for more information.=head1 ENVIRONMENT VARIABLESThe variable B<OPENSSL_CONF> if defined allows an alternative configurationfile location to be specified, it will be overridden by the B<-config> commandline switch if it is present. For compatibility reasons the B<SSLEAY_CONF>environment variable serves the same purpose but its use is discouraged.=head1 BUGSOpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectivelytreats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour.This can cause problems if you need characters that aren't available inPrintableStrings and you don't want to or can't use BMPStrings.As a consequence of the T61String handling the only correct way to representaccented characters in OpenSSL is to use a BMPString: unfortunately Netscapecurrently chokes on these. If you have to use accented characters with Netscapeand MSIE then you currently need to use the invalid T61String form.The current prompting is not very friendly. It doesn't allow you to confirm whatyou've just entered. Other things like extensions in certificate requests arestatically defined in the configuration file. Some of these: like an emailaddress in subjectAltName should be input by the user.=head1 SEE ALSOL<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,L<gendsa(1)|gendsa(1)>, L<config(5)|config(5)>=cut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -