openssl配置文件

root@DESKTOP-JP3S3AN:/home/wsl# cat /usr/lib/ssl/openssl.cnf
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#

# Note that you can include other files from the main configuration
# file using the .include directive.
#.include filename

# This definition stops the following lines choking if HOME isn't
# defined.
HOME                    = .

# Extra OBJECT IDENTIFIER info:
#oid_file               = $ENV::HOME/.oid
oid_section             = new_oids

# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions            =
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)

[ new_oids ]

# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
# Add a simple OID like this:
# testoid1=1.2.3.4
# Or use config file substitution like this:
# testoid2=${testoid1}.5.6

# Policies used by the TSA examples.
tsa_policy1 = 1.2.3.4.1
tsa_policy2 = 1.2.3.4.5.6
tsa_policy3 = 1.2.3.4.5.7

####################################################################
[ ca ]
default_ca      = CA_default            # 证书请求

####################################################################
[ CA_default ]

dir             = ./demoCA              # 保存所有信息的文件夹
certs           = $dir/certs            # 保存已生成证书的文件夹
crl_dir         = $dir/crl              # 保存吊销证书的文件夹
database        = $dir/index.txt        # 保存签发证书的文本数据库文件
#unique_subject = no                    # 同一个subject是否只能创建一个证书,设为no表示可以创
                                        # 建多个
new_certs_dir   = $dir/newcerts         # 保存新签发证书的默认目录,文件后缀是.pem


certificate     = $dir/cacert.pem       # 保存CA本身根证书的文件名
serial          = $dir/serial           # 签发证书时使用的序列号文本文件,里面必须包含下一个
                                        # 可用的16进制数字
crlnumber       = $dir/crlnumber        # 存放当前CRL编号的文件
                                        # 对于v1版本的CRL则必须注释掉该行
crl             = $dir/crl.pem          # 当前crl文件
private_key     = $dir/private/cakey.pem# 存放CA自身私钥的文件名

x509_extensions = usr_cert              # 定义X.509证书扩展项的字段
                                        # 没有提供这个字段则生成X.509v1而不是v3格式的证书。


# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt        = ca_default            # 用户需要确认签发证书时显示可读证书DN域的方式
cert_opt        = ca_default            # 当用户需要确认签发证书时显示证书域的方式

# Extension copying option: use with caution.
# copy_extensions = copy

# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions        = crl_ext

default_days    = 365                   # 证书默认有效期,以天为单位
default_crl_days= 30                    # 从当前CRL(证书撤销列表)到下次CRL发布的间隔天数
default_md      = default               # 签发证书以及CRL时默认摘要算法,可以使用:md5,md2,mdc2,sha1
preserve        = no                    # 参数顺序是否一致

# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
# 证书请求DN域匹配策略的字段 决定CA要求和处理证书请求提供的DN域的各个参数值的规则
policy          = policy_match

# For the CA policy
# 变量名称是DN域对象的名称,变量值可以是:
# match: 该变量在证书请求中的值必须与CA证书相应的变量值完全相同,否则拒签。
# supplied: 该变量在证书请求中必须提供(值可以不同),否则拒签。
# optional: 该变量在证书请求中可以存在也可以不存在(相当于没有要求)。
# 除非preserve=yes或者在ca命令中使用了-preserveDN,否则在签发证书时将删除匹配策略中未提及的对象。
[ policy_match ]
countryName             = match
stateOrProvinceName     = match
organizationName        = match
organizationalUnitName  = optional
commonName              = supplied
emailAddress            = optional

# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName             = optional
stateOrProvinceName     = optional
localityName            = optional
organizationName        = optional
organizationalUnitName  = optional
commonName              = supplied
emailAddress            = optional

####################################################################
[ req ]
default_bits            = 2048
default_keyfile         = privkey.pem
distinguished_name      = req_distinguished_name
attributes              = req_attributes
x509_extensions = v3_ca # The extensions to add to the self signed cert

# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret

# This sets a mask for permitted string types. There are several options.
# default: PrintableString, T61String, BMPString.
# pkix   : PrintableString, BMPString (PKIX recommendation before 2004)
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
string_mask = utf8only

# req_extensions = v3_req # The extensions to add to a certificate request

[ req_distinguished_name ]
countryName                     = Country Name (2 letter code)
countryName_default             = AU
countryName_min                 = 2
countryName_max                 = 2

stateOrProvinceName             = State or Province Name (full name)
stateOrProvinceName_default     = Some-State

localityName                    = Locality Name (eg, city)

0.organizationName              = Organization Name (eg, company)
0.organizationName_default      = Internet Widgits Pty Ltd

# we can do this but it is not needed normally :-)
#1.organizationName             = Second Organization Name (eg, company)
#1.organizationName_default     = World Wide Web Pty Ltd

organizationalUnitName          = Organizational Unit Name (eg, section)
#organizationalUnitName_default =

commonName                      = Common Name (e.g. server FQDN or YOUR name)
commonName_max                  = 64

emailAddress                    = Email Address
emailAddress_max                = 64

# SET-ex3                       = SET extension number 3

[ req_attributes ]
challengePassword               = A challenge password
challengePassword_min           = 4
challengePassword_max           = 20

unstructuredName                = An optional company name

[ usr_cert ]

# These extensions are added when 'ca' signs a request.

# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.

basicConstraints=CA:FALSE

# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.

# This is OK for an SSL server.
# nsCertType                    = server

# For an object signing certificate this would be used.
# nsCertType = objsign

# For normal client use this is typical
# nsCertType = client, email

# and for everything including object signing:
# nsCertType = client, email, objsign

# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment

# This will be displayed in Netscape's comment listbox.
nsComment                       = "OpenSSL Generated Certificate"

# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer

# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move

# Copy subject details
# issuerAltName=issuer:copy

#nsCaRevocationUrl              = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName

# This is required for TSA certificates.
# extendedKeyUsage = critical,timeStamping

[ v3_req ]

# Extensions to add to a certificate request

basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment

[ v3_ca ]


# Extensions for a typical CA


# PKIX recommendation.

subjectKeyIdentifier=hash

authorityKeyIdentifier=keyid:always,issuer

basicConstraints = critical,CA:true

# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign

# Some might want this also
# nsCertType = sslCA, emailCA

# Include email address in subject alt name: another PKIX recommendation
# subjectAltName=email:copy
# Copy issuer details
# issuerAltName=issuer:copy

# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, DER:30:03:01:01:FF

[ crl_ext ]

# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.

# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always

[ proxy_cert_ext ]
# These extensions should be added when creating a proxy certificate

# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.

basicConstraints=CA:FALSE

# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.

# This is OK for an SSL server.
# nsCertType                    = server

# For an object signing certificate this would be used.
# nsCertType = objsign

# For normal client use this is typical
# nsCertType = client, email

# and for everything including object signing:
# nsCertType = client, email, objsign

# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment

# This will be displayed in Netscape's comment listbox.
nsComment                       = "OpenSSL Generated Certificate"

# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer

# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move

# Copy subject details
# issuerAltName=issuer:copy

#nsCaRevocationUrl              = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName

# This really needs to be in place for it to be a proxy certificate.
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo

####################################################################
[ tsa ]

default_tsa = tsa_config1       # the default TSA section

[ tsa_config1 ]

# These are used by the TSA reply generation only.
dir             = ./demoCA              # TSA root directory
serial          = $dir/tsaserial        # The current serial number (mandatory)
crypto_device   = builtin               # OpenSSL engine to use for signing
signer_cert     = $dir/tsacert.pem      # The TSA signing certificate
                                        # (optional)
certs           = $dir/cacert.pem       # Certificate chain to include in reply
                                        # (optional)
signer_key      = $dir/private/tsakey.pem # The TSA private key (optional)
signer_digest  = sha256                 # Signing digest to use. (Optional)
default_policy  = tsa_policy1           # Policy if request did not specify it
                                        # (optional)
other_policies  = tsa_policy2, tsa_policy3      # acceptable policies (optional)
digests     = sha1, sha256, sha384, sha512  # Acceptable message digests (mandatory)
accuracy        = secs:1, millisecs:500, microsecs:100  # (optional)
clock_precision_digits  = 0     # number of digits after dot. (optional)
ordering                = yes   # Is ordering defined for timestamps?
                                # (optional, default: no)
tsa_name                = yes   # Must the TSA name be included in the reply?
                                # (optional, default: no)
ess_cert_id_chain       = no    # Must the ESS cert id chain be included?
                                # (optional, default: no)
ess_cert_id_alg         = sha1  # algorithm to compute certificate
                                # identifier (optional, default: sha1)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: OpenSSL是一个开放源码的加密库,使用广泛。在安装OpenSSL之前,首先需要获得适合自己操作系统的安装包。可以到OpenSSL官方网站下载最新版本的安装包。通常安装包会以压缩包的形式提供,我们需要解压缩来获得安装文件。 解压缩后,我们可以看到一些文件和文件夹,其中重要的是配置文件配置文件的名字通常叫做openssl.cnf。它包含了许多用于自定义OpenSSL的参数和选项的设置。 打开openssl.cnf,我们可以看到不同的区块,每个区块都代表着不同的设置。比如[CA_default]区块定义了一些默认的选项用于生成和管理证书颁发机构。 在配置文件中,可以根据自己的需求进行修改。比如可以设置默认的加密算法、默认的证书存储位置等。需要注意的是,对于一些敏感配置,比如私钥的存储位置,应该保持高度的安全性,并且只有授权人员能够访问。 配置文件还可以用于定义自定义的证书签名策略、证书请求信息以及其他一些高级功能。可以根据需要查阅OpenSSL的官方文档,了解每个选项的具体含义和用法。 在安装OpenSSL之前,建议先仔细阅读配置文件,理解每个选项的作用。同时,对于一些较为复杂的配置,也可以参考一些在线教程或者专业的OpenSSL的书籍。这样可以确保我们正确地配置OpenSSL,使其能够满足我们的需求。 ### 回答2: openssl是一种开源的加密库,用于安全传输数据。它提供了许多加密算法和安全功能,可用于创建安全的通信通道和保护数据的机密性。 要安装openssl,首先需要下载openssl安装包。可以从openssl的官方网站或其他可靠的下载来源获取安装包。安装包通常是以.tar.gz或.zip的压缩格式提供。下载完成后,将压缩文件解压缩到任意目录。 解压缩后,进入openssl目录。在此目录下运行"./config"命令来配置openssl,这将根据您的系统和需求生成适用于您的环境的Makefile文件。 配置过程中,您可以选择一些选项来定制openssl的安装。例如,您可以选择启用或禁用某些加密算法、选择安装路径、选择编译选项等。根据您的需求进行选择,并根据提示进行配置。 配置完成后,运行"make"命令来编译openssl。这将根据Makefile文件编译源代码,并生成可执行文件和库文件。编译过程可能需要一些时间,取决于您的系统性能和选择的编译选项。 编译完成后,运行"make install"命令来安装openssl。这将将生成的可执行文件和库文件复制到预定的安装路径中。安装完成后,您可以在安装路径下使用openssl命令来调用openssl的功能。 为了正确使用openssl,您还需要在系统中设置相应的环境变量。您可以将openssl的bin目录路径添加到系统的PATH变量中,这样您就可以在任意位置直接运行openssl命令。 除了安装包和配置文件外,openssl还提供了丰富的文档和示例代码,供您参考和学习。这些资源可以帮助您更好地理解openssl的使用和特性,从而更好地应用于实际项目中。 ### 回答3: OpenSSL是一个开放源代码的加密库,包括SSL协议的实现,其安装包和配置文件对于使用和配置OpenSSL非常重要。 首先,要安装OpenSSL,我们需要下载并获取OpenSSL安装包。可以通过访问OpenSSL官方网站或通过软件包管理器获取安装包。下载完成后,我们需要解压缩安装包并进入解压缩后的目录。 接下来,我们可以进行一些配置选项的设置。配置文件OpenSSL用来修改默认行为的重要文件。默认情况下,OpenSSL会在安装目录下搜索名为openssl.cnf的配置文件,我们可以使用该文件进行定制。我们可以根据自己的需求,设置不同的选项,如默认使用的加密算法、密钥和证书的存储位置等等。通过编辑配置文件,我们可以自定义更多功能和行为。 配置文件中的一些常用选项包括: - openssl_conf:指定默认的OpenSSL配置文件路径。 - RANDFILE:指定随机数文件的路径。 - dir:指定存放密钥和证书文件的目录。 - oid_file:指定用于命名对象标识符的文件路径。 - engines:指定加载或禁用特定密码引擎的选项。 在完成配置后,我们可以通过运行"./config"命令来执行配置过程。该命令将应用我们在配置文件中进行的修改。在配置过程中,我们还可以选择是否启用或禁用某些功能,例如禁用弱密码算法或启用TLS1.3等。 配置完成后,我们可以运行"make"和"make install"命令来编译和安装OpenSSL。这将生成可执行文件和库文件,并将它们安装到指定的目录。 通过正确设置OpenSSL的安装包和配置文件,我们可以根据自己的需求进行自定义。这样,我们就能够更好地使用和配置OpenSSL来满足我们的加密和安全需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值