失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 【国密】利用gmssl生成SM2证书nginx访问

【国密】利用gmssl生成SM2证书nginx访问

时间:2019-09-29 23:40:03

相关推荐

【国密】利用gmssl生成SM2证书nginx访问

之前我们项目的证书都是rsa的,这次本意是希望能升级到国密,但是理想过于丰满

一、GMSSL安装

# 下载wget /guanzhi/GmSSL/archive/master.zip# 解压unzip master.zip# 进入目录cd GmSSL-master# 配置config指定目录./config --prefix=/usr/local/gmsslmakemake install# 查看版本,验证是否安装成功cd /usr/local/gmssl/bin/gmssl version# 报错了,这是由于openssl库的位置不正确造成的bin/gmssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory# 现在基本都是建立软连接,但是可能都没说清楚就会比较懵。# 1.首先确认gmssl的安装路径,我的是/usr/local/gmssl# 2.应该将gmssl目录下的lib下的对应文件建立软连接# 3.确认以上两点后,执行下面的命令ln -s /usr/local/gmssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1ln -s /usr/local/gmssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1# 再执行bin/gmssl version,则正常返回版本信息

二、使nginx支持国密

一开始我认认真真的自己编译了nginx和gmssl,换了几个版本,但是编译出来后ssl_protocols都不能使用GMTLS

所谓前人栽树后人乘凉果然有道理,于是我找到了这个

nginx-gm

但是说明比较简约,要不是我自己之前尝试编译了nginx和gmssl,可能现在还在坑里爬不出来

# 下载上面地址的程序并解压unzip nginx-gm-master.zip # 进入目录cd nginx-gm-master/auto/lib/openssl# 备份原文件cp conf conf.bak# 编辑conf,将全部 $OPENSSL/.openssl/修改为$OPENSSL/vi conf# 回到原目录cd nginx-gm-master# 修改一下 vi build.sh# 主要修改了nginx安装完后的路径以及gmssl路径./auto/configure \--prefix=/usr/local/nginxgm \--with-http_ssl_module \--with-http_realip_module \--with-http_addition_module \--with-http_sub_module \--with-http_dav_module \--with-http_flv_module \--with-http_mp4_module \--with-http_gunzip_module \--with-http_gzip_static_module \--with-http_random_index_module \--with-http_secure_link_module \--with-http_stub_status_module \--with-http_auth_request_module \--with-threads \--with-stream \--with-stream_ssl_module \--with-http_slice_module \--with-mail \--with-mail_ssl_module \--with-file-aio \--with-http_v2_module \--with-openssl=/usr/local/gmssl # 执行build.shsh build.sh# 安装make install# 完成后/usr/local/nginxgm已有相关文件

三、sm2证书生成及验证

1.证书生成

# 1.以下命令在哪个目录执行的就会生成到哪个目录# f需要放在执行命令的目录下,主要修改了key usage,以便分别生成签名证书和加密证书,这个文件我附在本篇博客最后# 3.这里-extfile f -extensions v3_ca既是为了区分前面和加密证书也是为了生成v3版本的证书,如果不加生成的是V1版本的# 4.其实目前这里疑问还是挺多的,但是先上手再说# 生成CA证书/usr/local/gmssl/bin/gmssl ecparam -genkey -name sm2p256v1 -noout -out root.key/usr/local/gmssl/bin/gmssl req -new -key root.key -out root.req -subj "/C=CN/ST=HeBei/L=ShiJiaZhuang/O=WYW/CN=root"/usr/local/gmssl/bin/gmssl x509 -req -days 3650 -sm3 -in root.req -extfile f -extensions v3_ca -signkey root.key -out root.crt# Server签名证书/usr/local/gmssl/bin/gmssl ecparam -name sm2p256v1 -genkey -noout -out server.key/usr/local/gmssl/bin/gmssl req -new -SM3 -key server.key -out server.csr -subj /C=CN/ST=HeBei/L=ShiJiaZhuang/O=WYW/CN="192.168.46.161"/usr/local/gmssl/bin/gmssl x509 -req -SM3 -days 3650 -in server.csr -extfile f -extensions v3_req -CA root.crt -CAkey root.key -set_serial 1000000001 -out server.crt# Server加密证书/usr/local/gmssl/bin/gmssl ecparam -name sm2p256v1 -genkey -noout -out server_en.key/usr/local/gmssl/bin/gmssl req -new -SM3 -key server_en.key -out server1.csr -subj /C=CN/ST=HeBei/L=ShiJiaZhuang/O=WYW/CN="192.168.46.161"/usr/local/gmssl/bin/gmssl x509 -req -SM3 -days 3650 -in server1.csr -extfile f -extensions v3enc_req -CA root.crt -CAkey root.key -set_serial 1000002001 -out server_en.crt# 客户端签名证书/usr/local/gmssl/bin/gmssl ecparam -genkey -name sm2p256v1 -noout -out client.key/usr/local/gmssl/bin/gmssl req -new -key client.key -out client.req -subj "/C=CN/ST=HeBei/L=ShiJiaZhuang/O=WYW/CN=alipay"/usr/local/gmssl/bin/gmssl x509 -req -SM3 -days 3650 -in client.req -extfile f -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -out client.crt# 客户端加密证书/usr/local/gmssl/bin/gmssl ecparam -genkey -name sm2p256v1 -noout -out client_en.key/usr/local/gmssl/bin/gmssl req -new -key client_en.key -out client_en.req -subj "/C=CN/ST=HeBei/L=ShiJiaZhuang/O=WYW/CN=alipay"/usr/local/gmssl/bin/gmssl x509 -req -SM3 -days 3650 -in client_en.req -CA root.crt -extfile f -extensions v3enc_req -CAkey root.key -CAcreateserial -out client_en.crt

2.验证

2.1 gmssl提供的验证方式

/usr/local/gmssl/bin/gmssl s_server -port 443 -key gmzs2/server.key -cert gmzs2/server.crt -dkey gmzs2/server_en.key -dcert gmzs2/server_en.crt -CAfile gmzs2/root.crt

2.1.1 s_client验证

我们另外打开一个窗口,用s_client测试一下

/usr/local/gmssl/bin/gmssl s_client -connect localhost:443 -key gmzs2/client.key -cert gmzs2/client.crt -CAfile gmzs2/root.crt

这样也是ok的,在client端输入一些字符,s_server也能收到,哈哈哈哈,发出了莫名的笑声

我试了试就算证书验证失败,s_server还是能收到,微笑.jpg

就是这个client让我迷茫的一点是,为什么要带上根证书呢?

2.1.2 浏览器验证

这里我先用的密信浏览器,是能访问到的,360不行,可能需要后续研究

2.1 nginx验证

nginx-gm

回到我们刚才安装好的nginx,修改配置文件,这个说明里说需要配置三套证书(国密签名证书、国密加密证书、其他普通证书)

-0-在我积极的测试中发现其他普通证书指的是根证书,配置其他的都报错了。如下

# vi nginx.confserver {listen 443 ssl;server_name localhost;ssl_certificate/usr/local/gmzs2/server.crt;ssl_certificate_key /usr/local/gmzs2/server.key;ssl_certificate/usr/local/gmzs2/server_en.crt;ssl_certificate_key /usr/local/gmzs2/server_en.key;ssl_protocols TLSv1.2 TLSv1.3 GMTLS;ssl_certificate/usr/local/gmzs2/root.crt;ssl_certificate_key /usr/local/gmzs2/root.key;ssl_session_cache shared:SSL:1m;ssl_session_timeout 5m;ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:ECDHE-SM2-WITH-SMS4-GCM-SM3:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-SM2-WITH-SMS4-SHA256:ECDHE-SM2-WITH-SMS4-SM3:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:RSA-PSK-AES256-GCM-SHA384:DHE-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20-POLY1305:DHE-PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305:AES256-GCM-SHA384:PSK-AES256-GCM-SHA384:PSK-CHACHA20-POLY1305:RSA-PSK-AES128-GCM-SHA256:DHE-PSK-AES128-GCM-SHA256:AES128-GCM-SHA256:PSK-AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:ECDHE-PSK-AES256-CBC-SHA384:ECDHE-PSK-AES256-CBC-SHA:SRP-RSA-AES-256-CBC-SHA:SRP-AES-256-CBC-SHA:RSA-PSK-AES256-CBC-SHA384:DHE-PSK-AES256-CBC-SHA384:RSA-PSK-AES256-CBC-SHA:DHE-PSK-AES256-CBC-SHA:AES256-SHA:PSK-AES256-CBC-SHA384:PSK-AES256-CBC-SHA:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-CBC-SHA:SRP-RSA-AES-128-CBC-SHA:SRP-AES-128-CBC-SHA:RSA-PSK-AES128-CBC-SHA256:DHE-PSK-AES128-CBC-SHA256:RSA-PSK-AES128-CBC-SHA:DHE-PSK-AES128-CBC-SHA:SM9-WITH-SMS4-SM3:SM9DHE-WITH-SMS4-SM3:SM2-WITH-SMS4-SM3:SM2DHE-WITH-SMS4-SM3:AES128-SHA:RSA-WITH-SMS4-SHA1:RSA-WITH-SMS4-SM3:PSK-AES128-CBC-SHA256:PSK-AES128-CBC-SHA;# ssl_ciphers HIGH:!aNULL:!MD5;ssl_prefer_server_ciphers on;location / {root html;index index.html index.htm;}}# 检查配置文件sbin/nginx -t # 无误后启动sbin/nginx

我们打开密信浏览器进行验证,ok的,可以访问

四、用java生成客户端证书

其实这里我真的借鉴了很多代码,以下列上对我影响最大的两份开源代码,以表敬意。这两份开源代码让我对SM2数字证书从懵逼到稍微有那么一点了解,我最后写成的代码主要是生成客户端证书,所以都是从这里面借鉴的,供大家参考。

gmhelper

littleca

如果有需求简单也只需要生成客户端证书的也可以联系我。

吊销延期等操作只有RSA版本的,这个以后也可以写篇博客,现在网上流传的版本大多都过时了。

五、通信期望

1.其实这个我一开始还挺懵的,研究了一下发现好像现在没有对GMTLS的通信支持,比如携带sm2证书请求https接口这类的,其实这个初衷就是为了这个接口通信,尝试了但是都握手失败了,这个需要后续研究

2.但是还是记录一下我能解析携带sm2证书的步骤

//指定读取证书格式为PKCS12KeyStore keyStore = KeyStore.getInstance("PKCS12");

一开始我指定读取证书格式为PKCS12,报了Unknown named curve: 1.2.156.10197.1.301这个错

Exception in thread "main" java.security.cert.CertificateParsingException: java.io.IOException: Unknown named curve: 1.2.156.10197.1.301

后来修改为这样

KeyStore keyStore = KeyStore.getInstance("PKCS12", "BC");

又报错

java.security.NoSuchProviderException: no such provider: BC

解决方法是修改该程序所用的jdk的jre/lib/security目录下的java.security,增加如下配置,这个数字是几可以按你文件里最后一个+1即可

security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider

这样就能解析证书了,完整代码如下,大家调试的时候也可以配置上-.debug=all

package com.wyw.exchange.controller;import java.io.BufferedReader;import java.io.ByteArrayInputStream;import java.io.File;import java.io.FileInputStream;import java.io.InputStream;import java.io.InputStreamReader;import java.nio.file.Files;import java.nio.file.Paths;import java.nio.file.StandardOpenOption;import java.security.KeyStore;import java.security.Security;import .ssl.HostnameVerifier;import .ssl.SSLContext;import .ssl.SSLSession;import org.apache.http.HttpEntity;import org.apache.http.client.methods.CloseableHttpResponse;import org.apache.http.client.methods.HttpPost;import org.apache.http.conn.ssl.SSLConnectionSocketFactory;import org.apache.http.entity.InputStreamEntity;import org.apache.http.impl.client.CloseableHttpClient;import org.apache.http.impl.client.HttpClients;import org.apache.http.ssl.SSLContexts;public class TestController {public static String sendRedEnvelope(String url, String param) throws Exception {//PKCS12的密码String PKCS12 = "123456";//证书地址String fileRoute = "F:\\cert\\client\\sm2\\client/1599630757129/client.p12";//指定读取证书格式为PKCS12//KeyStore keyStore = KeyStore.getInstance("PKCS12");KeyStore keyStore = KeyStore.getInstance("PKCS12", "BC");//读取本机存放的PKCS12证书文件FileInputStream instream = new FileInputStream(new File(fileRoute));try (InputStream is = Files.newInputStream(Paths.get(fileRoute),StandardOpenOption.READ)) {keyStore.load(is, PKCS12.toCharArray());}//指定TLS版本SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, PKCS12.toCharArray()).build();//设置httpclient的SSLSocketFactorySSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext,new String[]{"TLSv1.2"},null,SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();StringBuffer stringBuffer = new StringBuffer();try {HttpPost httpPost = new HttpPost(url);InputStream is = new ByteArrayInputStream(param.getBytes("UTF-8"));//InputStreamEntity严格是对内容和长度相匹配的。用法和BasicHttpEntity类似InputStreamEntity inputStreamEntity = new InputStreamEntity(is, is.available());httpPost.setEntity(inputStreamEntity);CloseableHttpResponse response = httpclient.execute(httpPost);try {HttpEntity entity = response.getEntity();BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent(), "UTF-8"));String inputLine;while ((inputLine = reader.readLine()) != null) {stringBuffer.append(inputLine);}} finally {response.close();}} finally {httpclient.close();}return stringBuffer.toString();}public static void main(String args[]) throws Exception {sendRedEnvelope("https://192.168.46.161:443","123");}}

如上我的国密数字证书探索之旅也结束了,如果以上有任何问题的话请与我联系,多多指教!

--------------------分割线,到这里就结束了,下面附openssl-------------------------

key usage扩展为Digital Signature, Non-Repudiation, Key Encipherment(e0),证书可以用来加密和签名。

key usage扩展为Digital Signature没有加密功能,只能用来签名。

key usage扩展为keyEncipherment没有签名功能,只能用来加密。

f

## 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/.oidoid_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.1tsa_policy2 = 1.2.3.4.5.6tsa_policy3 = 1.2.3.4.5.7####################################################################[ ca ]default_ca= CA_default# The default ca section####################################################################[ CA_default ]dir= /usr/local/gmzs2# Where everything is keptcerts= $dir/certs# Where the issued certs are keptcrl_dir= $dir/crl# Where the issued crl are keptdatabase= $dir/index.txt# database index file.#unique_subject= no# Set to 'no' to allow creation of# several certs with same subject.new_certs_dir= $dir/newcerts# default place for new certs.certificate= $dir/cacert.pem # The CA certificateserial= $dir/serial # The current serial numbercrlnumber= $dir/crlnumber# the current crl number# must be commented out to leave a V1 CRLcrl= $dir/crl.pem # The current CRLprivate_key= $dir/private/cakey.pem # The private keyRANDFILE= $dir/private/.rand# private random number filex509_extensions= usr_cert# The extensions to add to the cert# Comment out the following two lines for the "traditional"# (and highly broken) format.name_opt = ca_default# Subject Name optionscert_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_extdefault_days= 365# how long to certify fordefault_crl_days= 30# how long before next CRLdefault_md= default# use public key default MDpreserve= 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 ]countryName= matchstateOrProvinceName= matchorganizationName= matchorganizationalUnitName= optionalcommonName= suppliedemailAddress= optional# For the 'anything' policy# At this point in time, you must list all acceptable 'object'# types.[ policy_anything ]countryName= optionalstateOrProvinceName= optionallocalityName= optionalorganizationName= optionalorganizationalUnitName= optionalcommonName= suppliedemailAddress= optional####################################################################[ req ]default_bits= 2048default_keyfile = privkey.pemdistinguished_name= req_distinguished_nameattributes= req_attributesx509_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 )# utf8only: only UTF8Strings (PKIX recommendation after ).# 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= CNcountryName_min= 2countryName_max= 2stateOrProvinceName= State or Province Name (full name)stateOrProvinceName_default= Some-StatelocalityName= Locality Name (eg, city)anizationName= Organization Name (eg, company)anizationName_default= Internet Widgits Pty Ltd# we can do this but it is not needed normally :-)#anizationName= Second Organization Name (eg, company)#anizationName_default= World Wide Web Pty LtdorganizationalUnitName= Organizational Unit Name (eg, section)#organizationalUnitName_default=commonName= Common Name (e.g. server FQDN or YOUR name)commonName_max= 64emailAddress= Email AddressemailAddress_max= 64# SET-ex3= SET extension number 3[ req_attributes ]challengePassword= A challenge passwordchallengePassword_min= 4challengePassword_max= 20unstructuredName= 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# keyUsage = digitalSignaturekeyUsage = keyEncipherment# This will be displayed in Netscape's comment listbox.nsComment= "OpenSSL Generated Certificate"# PKIX recommendations harmless if included in all certificates.subjectKeyIdentifier=hashauthorityKeyIdentifier=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 requestbasicConstraints = CA:FALSEkeyUsage = nonRepudiation, digitalSignature[ v3enc_req ]# Extensions to add to a certificate requestbasicConstraints = CA:FALSEkeyUsage = keyAgreement, keyEncipherment, dataEncipherment[ v3_ca ]# Extensions for a typical CA# PKIX recommendation.subjectKeyIdentifier=hashauthorityKeyIdentifier=keyid:always,issuerbasicConstraints = 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:copyauthorityKeyIdentifier=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=hashauthorityKeyIdentifier=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 directoryserial= $dir/tsaserial# The current serial number (mandatory)crypto_device= builtin# OpenSSL engine to use for signingsigner_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= sm3# 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= sm3, 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)

如果觉得《【国密】利用gmssl生成SM2证书nginx访问》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。