Linux gpgsm 使用
-
Ubuntu 20.04
生成自签名证书
gpgsm --generate-key --output=notfound.cn.pem
-
--output
将证书信息保存到notfound.cn.pem
创建自签名证书,输入内容如下:
Create self-signed certificate? (y/N) y
These parameters are used:
Key-Type: RSA
Key-Length: 3072
Key-Usage: sign, encrypt
Serial: random
Name-DN: CN=notfound.cn
Name-Email: notfound@notfound.cn
导入证书
gpgsm --import notfound.cn.pem
查看证书列表:
gpgsm --list-keys
输出结果:
ID: 0xD4C585CE
S/N: 4D22E0B20A614E91
Issuer: /CN=notfound.cn
Subject: /CN=notfound.cn
aka: notfound@notfound.cn
validity: 2021-11-26 02:49:05 through 2063-04-05 17:00:00
key type: 3072 bit RSA
key usage: digitalSignature nonRepudiation keyEncipherment dataEncipherment
chain length: unlimited
fingerprint: 32:C8:B0:FC:89:E7:5C:77:27:F9:64:39:0B:D6:75:B7:D4:C5:85:CE