我實(shí)踐:自建CA及證書頒發(fā)(openssl)

@[toc]
用openssl搭建CA并頒發(fā)證書過程詳解。
下面介紹了技術(shù)細(xì)節(jié),如果你想直接上手,不想了解技術(shù)細(xì)節(jié),可以直接使用我的一個項(xiàng)目https://gitee.com/zhf_sy/zzxia-openssl-ca-server,他可以生成各種證書。

1 搭建CA

1.1 建立CA目錄與文件

基于默認(rèn)配置文件(openssl.conf)有稍作改動以便于使用

目錄結(jié)構(gòu):

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為用戶頒發(fā)證書而建立:

* from_user_csr:用以存放用戶的證書請求文件,
* to_user_crt  :用以存放CA為用戶頒發(fā)的證書文件,另外:newcerts(新的)及certs(曾經(jīng)的)也是存放CA頒發(fā)的用戶證書路徑

其他目錄都是依據(jù)openssl.conf創(chuàng)建:

* private    :存放ca的秘鑰ca.key.pem的目錄與文件名
* ca.crt.pem :ca證書
* index.txt  :ca數(shù)據(jù)庫,初始值為空
* serial     :下一個證書的編號,初始為兩位數(shù),比如:01
* crlnumber  :下一個吊銷證書的編號,初始為兩位數(shù),比如:01
* newcerts   :新頒發(fā)的證書
* certs      :用來保存的已頒發(fā)證書
* 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服務(wù)器證書也是自簽名證書,所以也不能使用配置文件
  • 生成的證書都是pem格式的,文件名是ca.crt.pem或者ca.crt都無所謂

1.3 證書頒發(fā)之配置文件準(zhǔn)備openssl.cnf

確認(rèn)配置文件中ca相關(guān)信息(CA_default節(jié))的正確
配置用戶證書請求與CA頒發(fā)中用到的信息:用戶信息(req_distinguished_name節(jié))、通用名稱(commonName)、備用名稱(alt_names節(jié))
openssl.cnf用途:

  • 用戶在生成證書請求時會用到以上信息(用戶信息、通用名稱、備用名稱)
  • CA服務(wù)器在頒發(fā)證書時會用到以上信息及CA相關(guān)信息

openssl.cnf文件中配置關(guān)系圖(簡書不支持這種語法):

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)

[圖片上傳失敗...(image-f453a3-1710129093643)]

2 頒發(fā)證書

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 
# 查看證書請求內(nèi)容
openssl req -in from_user_csr/docker-repo.csr -noout -text

2.2 CA服務(wù)器頒發(fā)證書

# 將證書請求文件cp到服務(wù)器上,比如:from_user_csr/docker-repo.csr
# 如果需要備用名,需要編輯openssl.cnf(服務(wù)器上)
# 頒發(fā):
#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相關(guān)文件,因?yàn)閛penssl.cnf中已經(jīng)定義:
openssl ca -in from_user_csr/docker-repo.csr -out to_user_crt/docker-repo.crt -extensions v3_req -config openssl.cnf 

# 查看辦法的證書內(nèi)容:
openssl x509 -in to_user_crt/docker-repo.crt -noout -text

2.3 變量方式方便點(diǎn):

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 [admin@zjlh.lan]:

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              = admin@zjlh.lan
        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/emailAddress=kevinzu007@zzxia.vip
        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/emailAddress=admin@zjlh.lan
        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)

如果出現(xiàn)了以上錯誤,則請修改openssl.cnf中"[ policy_match ]"里的項(xiàng):

#如果值為"match",則客戶端證書請求時,相應(yīng)信息必須和CA證書保持一致;反之如果為"optional",則不用
#countryName    = match
countryName     = optional
#stateOrProvinceName    = match
stateOrProvinceName = optional
#organizationName   = match
organizationName    = optional
organizationalUnitName  = optional
commonName      = supplied
emailAddress        = optional

2.6 v3擴(kuò)展說明

一般用來增加證書備用名稱

證書請求中添加v3擴(kuò)展:

在openssl.cnf中開啟 req_extensions = v3_req,添加備用名稱則修改[ alt_names ]節(jié)

在CA證書頒發(fā)時啟用v3擴(kuò)展

命令行增加 "-extensions v3_req" 及[ alt_names ]節(jié)

總結(jié)

  1. 不管證書請求中是否有v3擴(kuò)展,都可以在證書頒發(fā)時添加擴(kuò)展:命令行添加 "-extensions v3_req",并在openssl.cnf中,"req_extensions = v3_req"及[ alt_names ]下的內(nèi)容;
  2. 不管證書請求中是否有v3擴(kuò)展,可以在證書頒發(fā)時關(guān)閉擴(kuò)展:去掉擴(kuò)展命令即可 "-extensions v3_req";
  3. 頒發(fā)出來的證書有沒有擴(kuò)展與證書請求無關(guān),與命令行是否添加 "-extensions v3_req"有關(guān);
  4. 證書擴(kuò)展的備用名稱與證書請求也是無關(guān)的,因?yàn)樽C書頒發(fā)最終使用的備用名稱是ca上openssl.cnf中[ alt_names ]下的內(nèi)容;
  5. 也就是證書請求時v3擴(kuò)展的備用名稱只有提示用途,最終證書中的備用名稱只與ca上openssl.cnf中[ alt_names ]下的內(nèi)容相關(guān);

另:

增加備用名稱,請修改以下內(nèi)容:

[ alt_names ]
# commonName值必須也出現(xiàn)在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    #---為什么沒有根據(jù)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簽名的證書的區(qū)別

自簽名的證書無法被吊銷,CA簽名的證書可以被吊銷 能不能吊銷證書的區(qū)別在于,如果你的私鑰被黑客獲取,如果證書不能被吊銷,則黑客可以偽裝成你與用戶進(jìn)行通信
如果你的規(guī)劃需要創(chuàng)建多個證書,那么使用私有CA的方法比較合適,因?yàn)橹灰o所有的客戶端都安裝了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

# 頒發(fā)的證書路徑
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數(shù)據(jù)庫
database        = $dir/index.txt        # database index file.
serial          = $dir/serial           # The current serial number,手動設(shè)置初始值01
crlnumber       = $dir/crlnumber        # the current crl number,手動設(shè)置初始值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

# 添加證書擴(kuò)展
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

# 吊銷列表擴(kuò)展
# 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",則客戶端證書請求時,相應(yīng)信息必須和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

# 添加自簽名證書擴(kuò)展
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

# 添加證書請求擴(kuò)展
# 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    = admin@c919.lan

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

unstructuredName                = An optional company name



# CA在簽名時添加擴(kuò)展
[ 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

# 證書請求擴(kuò)展
[ 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 的數(shù)量可以自己加,common name的值也必須添加到這里
[ alt_names ]
DNS.1 = c919.lan
DNS.2 = *.c919.lan
DNS.3 = docker-repo


# CA擴(kuò)展
[ 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

# 證書吊銷擴(kuò)展
[ crl_ext ]
# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.

# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always


# 代理證書擴(kuò)展
[ 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)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容