我实践:自建CA及证书颁发(openssl)

1 搭建CA

1.1 建立CA目录与文件

基于默认配置文件(openssl.conf)有稍作改动以便于使用

目录结构:

kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ tree
.
├── ca.crt.pem
├── ca.csr.pem
├── certs
├── crl
├── crlnumber
├── from_user_csr
│   ├── c919.lan.csr
│   ├── c919.lan.key
│   ├── zjlh.lan.csr
│   └── zjlh.lan.key
├── index.txt
├── index.txt.attr
├── index.txt.attr.old
├── index.txt.old
├── newcerts
│   ├── 01.pem
│   └── 02.pem
├── openssl.cnf---c919.lan
├── openssl.cnf---zjlh.lan
├── private
│   └── ca.key.pem
├── readme.md
├── serial
├── serial.old
└── to_user_crt
    ├── c919.lan.crt
    └── zjlh.lan.crt

6 directories, 21 files

以下目录都是为了方便CA为用户颁发证书而建立:

* from_user_csr:用以存放用户的证书请求文件,
* to_user_crt  :用以存放CA为用户颁发的证书文件,另外:newcerts(新的)及certs(曾经的)也是存放CA颁发的用户证书路径

其他目录都是依据openssl.conf创建:

* private    :存放ca的秘钥ca.key.pem的目录与文件名
* ca.crt.pem :ca证书
* index.txt  :ca数据库,初始值为空
* serial     :下一个证书的编号,初始为两位数,比如:01
* crlnumber  :下一个吊销证书的编号,初始为两位数,比如:01
* newcerts   :新颁发的证书
* certs      :用来保存的已颁发证书
* crl.pem    :CA吊销证书
* crl        :用来保持的已吊销证书

1.2 生成CA私钥及证书

openssl genrsa -out private/ca.key.pem 4096
openssl req -new  -key private/ca.key.pem  -out ca.csr.pem
openssl x509 -days 3650 -req  -in ca.csr.pem  -signkey private/ca.key.pem  -out ca.crt.pem
  • 自签名证书无法使用配置文件,CA服务器证书也是自签名证书,所以也不能使用配置文件
  • 生成的证书都是pem格式的,文件名是ca.crt.pem或者ca.crt都无所谓

1.3 证书颁发之配置文件准备openssl.cnf

确认配置文件中ca相关信息(CA_default节)的正确
配置用户证书请求与CA颁发中用到的信息:用户信息(req_distinguished_name节)、通用名称(commonName)、备用名称(alt_names节)
openssl.cnf用途:

  • 用户在生成证书请求时会用到以上信息(用户信息、通用名称、备用名称)
  • CA服务器在颁发证书时会用到以上信息及CA相关信息

openssl.cnf文件中配置关系图(不支持这种语法):

graph LR;

1(openssl.conf)-->2(new__oids)
1-->3(ca)
1-->4(req)
1-->5(policy_anything)
1-->6(proxy_cert_ext)
1-->7(tsa)

3-->8(CA_default)
8-->9(usr_cert)
8-->10(crl_ext)
8-->11(policy_match)

4-->12(req_distinguished_name)
4-->13(req_attributes)
4-->14(v3_ca)
4-->15(v3_req)
15-->16(alt_names)
我实践:自建CA及证书颁发(openssl)_第1张图片
openssl.cnf文件中配置关系图

2 颁发证书

2.1 用户自己生成秘钥与证书请求(可以在自己的PC上完成)

# 生成秘钥(秘钥中包含私钥和公钥)
openssl genrsa -out from_user_csr/docker-repo.key 2048  

# 用户生成证书请求,如果需要备用名,需要使用openssl.cnf
openssl req -new -key from_user_csr/docker-repo.key  -out from_user_csr/docker-repo.csr -config  openssl.cnf 
# 查看证书请求内容
openssl req -in from_user_csr/docker-repo.csr -noout -text

2.2 CA服务器颁发证书

# 将证书请求文件cp到服务器上,比如:from_user_csr/docker-repo.csr
# 如果需要备用名,需要编辑openssl.cnf(服务器上)
# 颁发:
#openssl ca -in from_user_csr/docker-repo.csr -out to_user_crt/docker-repo.crt -cert ca.crt -keyfile ca.key -extensions v3_req -config openssl.cnf 
# 省略ca相关文件,因为openssl.cnf中已经定义:
openssl ca -in from_user_csr/docker-repo.csr -out to_user_crt/docker-repo.crt -extensions v3_req -config openssl.cnf 

# 查看办法的证书内容:
openssl x509 -in to_user_crt/docker-repo.crt -noout -text

2.3 变量方式方便点:

DOMAIN='zjlh.lan'
openssl genrsa -out from_user_csr/${DOMAIN}.key  2048
openssl req -new  -key from_user_csr/${DOMAIN}.key  -out from_user_csr/${DOMAIN}.csr -config  openssl.cnf---${DOMAIN}
openssl req  -in from_user_csr/${DOMAIN}.csr  -noout -text
openssl ca  -in from_user_csr/${DOMAIN}.csr  -out to_user_crt/${DOMAIN}.crt  -extensions v3_req  -config openssl.cnf---${DOMAIN}
openssl x509  -in to_user_crt/${DOMAIN}.crt  -noout -text

2.4 例子

kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ DOMAIN='zjlh.lan'
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ openssl genrsa -out from_user_csr/${DOMAIN}.key  2048
Generating RSA private key, 2048 bit long modulus
..........................................................................+++
..................+++
e is 65537 (0x10001)
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ 
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ openssl req -new  -key from_user_csr/${DOMAIN}.key  -out from_user_csr/${DOMAIN}.csr -config  openssl.cnf---${DOMAIN}
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [CN]:
State or Province Name (full name) [GuangDong]:
Locality Name (eg, city) [GuangZhou]:
Organization Name (eg, company) [ZJLH]:
Organizational Unit Name (eg, section) [IT]:
Common Name (eg, your name or your server's hostname) [zjlh.lan]:
Email Address [[email protected]]:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ 
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ openssl ca  -in from_user_csr/${DOMAIN}.csr  -out to_user_crt/${DOMAIN}.crt  -extensions v3_req  -config openssl.cnf---${DOMAIN}
Using configuration from openssl.cnf---zjlh.lan
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 1 (0x1)
        Validity
            Not Before: Sep 26 05:41:47 2020 GMT
            Not After : Sep 26 05:41:47 2021 GMT
        Subject:
            countryName               = CN
            stateOrProvinceName       = GuangDong
            organizationName          = ZJLH
            organizationalUnitName    = IT
            commonName                = zjlh.lan
            emailAddress              = [email protected]
        X509v3 extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            X509v3 Key Usage: 
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Subject Alternative Name: 
                DNS:zjlh.lan, DNS:*.zjlh.lan, DNS:docker-repo
Certificate is to be certified until Sep 26 05:41:47 2021 GMT (365 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ 
kevin@kevin-TM1701:~/gaoshi/zzxia-CA-openssl$ openssl x509  -in to_user_crt/${DOMAIN}.crt  -noout -text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=CN, ST=GuangDong, L=GuangZhou, O=\xC3\xA7\xC2\x8C\xC2\xAA\xC3\xA7\xC2\x8C\xC2\xAA\xC3\xA4\xC2\xBE\xC2\xA0\xC3\xA9\xC2\x9B\xC2\x86\xC3\xA5\xC2\x9B\xC2\xA2, OU=IT, CN=zzxia-root-CA/[email protected]
        Validity
            Not Before: Sep 26 05:41:47 2020 GMT
            Not After : Sep 26 05:41:47 2021 GMT
        Subject: C=CN, ST=GuangDong, O=ZJLH, OU=IT, CN=zjlh.lan/[email protected]
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:c8:a0:a8:ea:33:87:98:22:c2:83:ba:7e:a3:4b:
                    4e:b8:38:cb:21:32:fd:06:41:8d:2e:e9:2f:19:35:
                    ......
                    fa:83:04:62:26:09:03:64:fc:0b:57:aa:36:ad:00:
                    3e:7d:08:cb:11:f2:c7:68:74:a7:78:aa:47:76:4f:
                    60:33
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            X509v3 Key Usage: 
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Subject Alternative Name: 
                DNS:zjlh.lan, DNS:*.zjlh.lan, DNS:docker-repo
    Signature Algorithm: sha256WithRSAEncryption
         84:e1:d8:36:41:f7:b8:4f:3a:a1:e6:18:2a:50:8e:0b:24:7d:
         9a:f6:7e:8d:ed:93:44:7a:d3:26:23:9d:36:f0:4f:d1:bb:ee:
         ......
         86:32:9e:88:fd:a9:5d:cc:e9:3c:55:be:e6:d9:9c:ae:fd:51:
         38:da:ab:c2:4f:b9:d0:8f:df:49:89:94:03:f6:8e:45:64:9d:
         e9:93:75:4a:0a:29:45:96

2.5 错误:

[root@localhost CA]# openssl ca -in server.csr -out server.crt
Using configuration from ./openssl.cnf
Check that the request matches the signature
Signature ok
The organizationName field needed to be the same in the
CA certificate (ZZXIA) and the request (ZJLH)

如果出现了以上错误,则请修改openssl.cnf中"[ policy_match ]"里的项:

#如果值为"match",则客户端证书请求时,相应信息必须和CA证书保持一致;反之如果为"optional",则不用
#countryName    = match
countryName     = optional
#stateOrProvinceName    = match
stateOrProvinceName = optional
#organizationName   = match
organizationName    = optional
organizationalUnitName  = optional
commonName      = supplied
emailAddress        = optional

2.6 v3扩展说明

一般用来增加证书备用名称

证书请求中添加v3扩展:

在openssl.cnf中开启 req_extensions = v3_req,添加备用名称则修改[ alt_names ]节

在CA证书颁发时启用v3扩展

命令行增加 "-extensions v3_req" 及[ alt_names ]节

总结

  1. 不管证书请求中是否有v3扩展,都可以在证书颁发时添加扩展:命令行添加 "-extensions v3_req",并在openssl.cnf中,"req_extensions = v3_req"及[ alt_names ]下的内容;
  2. 不管证书请求中是否有v3扩展,可以在证书颁发时关闭扩展:去掉扩展命令即可 "-extensions v3_req";
  3. 颁发出来的证书有没有扩展与证书请求无关,与命令行是否添加 "-extensions v3_req"有关;
  4. 证书扩展的备用名称与证书请求也是无关的,因为证书颁发最终使用的备用名称是ca上openssl.cnf中[ alt_names ]下的内容;
  5. 也就是证书请求时v3扩展的备用名称只有提示用途,最终证书中的备用名称只与ca上openssl.cnf中[ alt_names ]下的内容相关;

另:

增加备用名称,请修改以下内容:

[ alt_names ]
# commonName值必须也出现在alt_names备用名称列表中
DNS.1 = zjlh.lan
DNS.2 = *.zjlh.lan
#DNS.n = zzxia.vip

3 吊销证书

# 查询需要吊销证书信息
#openssl x509 -in newcerts/03.pem -noout -serial -subject
openssl x509 -in to_user_crt/docker-repo.crt -noout -serial -subject
# 吊销
openssl ca -revoke newcerts/03.pem  -config openssl.cnf

4 更新吊销证书列表

#openssl ca -gencrl   -config openssl.cnf    #---为什么没有根据openssl.cnf更新crl.pem
openssl ca -gencrl -out crl.pem  -config openssl.cnf
# 查看
openssl crl -in crl.pem -noout -text

5 客户端安装ca证书

# ubuntu
#sudo  cp gc-ca.crt  /usr/local/share/ca-certificates/
sudo  cp gc-ca.crt.pem  /usr/local/share/ca-certificates/
sudo update-ca-certificates

# centos
cp gc-ca.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust

6 自签名证书和私有CA签名的证书的区别

自签名的证书无法被吊销,CA签名的证书可以被吊销 能不能吊销证书的区别在于,如果你的私钥被黑客获取,如果证书不能被吊销,则黑客可以伪装成你与用户进行通信
如果你的规划需要创建多个证书,那么使用私有CA的方法比较合适,因为只要给所有的客户端都安装了CA的证书,那么以该证书签名过的证书,客户端都是信任的,也就是安装一次就够了
如果你直接用自签名证书,你需要给所有的客户端安装该证书才会被信任,如果你需要第二个证书,则还的挨个给所有的客户端安装证书2才会被信任。

7 good

参考:https://blog.csdn.net/u014721096/article/details/78571287

8 openssl.cnf:

(打包是最好的,但是没有地方长存,不如就贴这里吧)

#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#

# This definition stops the following lines choking if HOME isn't
# defined.
HOME                    = .
RANDFILE                = $ENV::HOME/.rnd

# 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            # The default ca section

####################################################################
[ CA_default ]
dir             = /home/kevin/gaoshi/zzxia-CA-openssl           # Where everything is kept

# 颁发的证书路径
new_certs_dir   = $dir/newcerts         # default place for new certs.
certs           = $dir/certs            # Where the issued certs are kept
crl             = $dir/crl.pem          # The current CRL
crl_dir         = $dir/crl              # Where the issued crl are kept
#unique_subject = no            # Set to 'no' to allow creation of
                                        # several ctificates with same subject.

# ca数据库
database        = $dir/index.txt        # database index file.
serial          = $dir/serial           # The current serial number,手动设置初始值01
crlnumber       = $dir/crlnumber        # the current crl number,手动设置初始值01
                                # must be commented out to leave a V1 CRL

# ca证书等
certificate     = $dir/ca.crt.pem       # The CA certificate
private_key     = $dir/private/ca.key.pem  # The private key
RANDFILE        = $dir/private/.rand    # private random number file

# 添加证书扩展
x509_extensions = usr_cert              # The extentions to add to the cert

# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt        = ca_default            # Subject Name options
cert_opt        = ca_default            # Certificate field options

# 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
crl_extensions  = crl_ext

# 
default_days    = 365                   # how long to certify for
default_crl_days= 30                    # how long before next CRL
default_md      = sha256                # use SHA-256 by default
preserve        = no                    # keep passed DN ordering

# 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 :-)
policy          = policy_match



# For the CA policy
[ policy_match ]
#如果值为"match",则客户端证书请求时,相应信息必须和CA证书保持一致;反之如果为"optional",则不用
#countryName    = match
countryName             = optional
#stateOrProvinceName    = match
stateOrProvinceName     = optional
#organizationName       = match
organizationName        = optional

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_md              = sha256
default_keyfile         = privkey.pem
distinguished_name      = req_distinguished_name
attributes              = req_attributes

# 添加自签名证书扩展
x509_extensions = v3_ca # The extentions 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_extensions = v3_req       # The extensions to add to a certificate request

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

stateOrProvinceName             = State or Province Name (full name)
stateOrProvinceName_default     = GuangDong

localityName                    = Locality Name (eg, city)
localityName_default            = GuangZhou

0.organizationName              = Organization Name (eg, company)
0.organizationName_default      = ZZXia Group

# 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  = IT

commonName                      = Common Name (eg, your name or your server\'s hostname)
commonName_default              = c919.lan
commonName_max                  = 64

emailAddress                    = Email Address
emailAddress_max                = 64
emailAddress_default    = [email protected]

# SET-ex3                       = SET extension number 3
[ req_attributes ]
challengePassword               = A challenge password
challengePassword_min           = 4
challengePassword_max           = 20

unstructuredName                = An optional company name



# CA在签名时添加扩展
[ 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

# kz --- 添加备用名
subjectAltName = @alt_names

# kz
# 新增 alt_names,注意括号前后的空格,DNS.x 的数量可以自己加,common name的值也必须添加到这里
[ alt_names ]
DNS.1 = c919.lan
DNS.2 = *.c919.lan
DNS.3 = docker-repo


# CA扩展
[ v3_ca ]
# Extensions for a typical CA

# PKIX recommendation.

subjectKeyIdentifier=hash

authorityKeyIdentifier=keyid:always,issuer

# This is what PKIX recommends but some broken software chokes on critical
# extensions.
#basicConstraints = critical,CA:true
# So we do this instead.
basicConstraints = 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)

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)

我实践:自建CA及证书颁发(openssl)_第2张图片

你可能感兴趣的:(我实践:自建CA及证书颁发(openssl))