gpg (GnuPG/MacGPG2) 2.2.34; Copyright (C) 2022 g10 Code GmbH This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) (7) DSA (set your own capabilities) (8) RSA (set your own capabilities) (9) ECC and ECC (10) ECC (sign only) (11) ECC (set your own capabilities) (13) Existing key (14) Existing key from card Your selection? 11
Possible actions for a ECDSA/EdDSA key: Sign Certify Authenticate Current allowed actions: Sign Certify
(S) Toggle the sign capability (A) Toggle the authenticate capability (Q) Finished
# 这里关闭 Sign 功能,使 Master Key 仅拥有 Certify 功能。 Your selection? S
Possible actions for a ECDSA/EdDSA key: Sign Certify Authenticate Current allowed actions: Certify
(S) Toggle the sign capability (A) Toggle the authenticate capability (Q) Finished
Your selection? Q Please selectwhich elliptic curve you want: (1) Curve 25519 (3) NIST P-256 (4) NIST P-384 (5) NIST P-521 (6) Brainpool P-256 (7) Brainpool P-384 (8) Brainpool P-512 (9) secp256k1 Your selection? 1 Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Jing Li Email address: [email protected] Comment: Your Comment You selected this USER-ID: "Jing Li (Your Comment) <[email protected]>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. gpg: revocation certificate stored as '/Users/lixeon/.gnupg/openpgp-revocs.d/48056EA23656CAEB32B0697C910711ACF19A5FDF.rev' public and secret key created and signed.
gpg (GnuPG/MacGPG2) 2.2.34; Copyright (C) 2022 g10 Code GmbH This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
sec ed25519/910711ACF19A5FDF created: 2022-06-21 expires: never usage: C trust: ultimate validity: ultimate [ultimate] (1). Jing Li (Your Comment) <[email protected]>
# 新增密钥 gpg> addkey
Please select what kind of key you want: (3) DSA (sign only) (4) RSA (sign only) (5) Elgamal (encrypt only) (6) RSA (encrypt only) (7) DSA (set your own capabilities) (8) RSA (set your own capabilities) (10) ECC (sign only) (11) ECC (set your own capabilities) (12) ECC (encrypt only) (13) Existing key (14) Existing key from card Your selection? 10 Please selectwhich elliptic curve you want: (1) Curve 25519 (3) NIST P-256 (4) NIST P-384 (5) NIST P-521 (6) Brainpool P-256 (7) Brainpool P-384 (8) Brainpool P-512 (9) secp256k1 Your selection? 1 Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y Really create? (y/N) y We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.
sec ed25519/910711ACF19A5FDF created: 2022-06-21 expires: never usage: C trust: ultimate validity: ultimate ssb ed25519/8A67550C0D04E806 created: 2022-06-21 expires: never usage: S [ultimate] (1). Jing Li (Your Comment) <[email protected]>
gpg> addkey Please select what kind of key you want: (3) DSA (sign only) (4) RSA (sign only) (5) Elgamal (encrypt only) (6) RSA (encrypt only) (7) DSA (set your own capabilities) (8) RSA (set your own capabilities) (10) ECC (sign only) (11) ECC (set your own capabilities) (12) ECC (encrypt only) (13) Existing key (14) Existing key from card Your selection? 12 Please selectwhich elliptic curve you want: (1) Curve 25519 (3) NIST P-256 (4) NIST P-384 (5) NIST P-521 (6) Brainpool P-256 (7) Brainpool P-384 (8) Brainpool P-512 (9) secp256k1 Your selection? 1 Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y Really create? (y/N) y We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.
sec ed25519/910711ACF19A5FDF created: 2022-06-21 expires: never usage: C trust: ultimate validity: ultimate ssb ed25519/8A67550C0D04E806 created: 2022-06-21 expires: never usage: S ssb cv25519/4223A00DEEC08AC1 created: 2022-06-21 expires: never usage: E [ultimate] (1). Jing Li (Your Comment) <[email protected]>
gpg> addkey Please select what kind of key you want: (3) DSA (sign only) (4) RSA (sign only) (5) Elgamal (encrypt only) (6) RSA (encrypt only) (7) DSA (set your own capabilities) (8) RSA (set your own capabilities) (10) ECC (sign only) (11) ECC (set your own capabilities) (12) ECC (encrypt only) (13) Existing key (14) Existing key from card Your selection? 11
Possible actions for a ECDSA/EdDSA key: Sign Authenticate Current allowed actions: Sign
(S) Toggle the sign capability (A) Toggle the authenticate capability (Q) Finished
# 关闭 Sign 功能 Your selection? S
Possible actions for a ECDSA/EdDSA key: Sign Authenticate Current allowed actions:
(S) Toggle the sign capability (A) Toggle the authenticate capability (Q) Finished
# 增加 Authenticate 功能 Your selection? A
Possible actions for a ECDSA/EdDSA key: Sign Authenticate Current allowed actions: Authenticate
(S) Toggle the sign capability (A) Toggle the authenticate capability (Q) Finished
Your selection? Q Please selectwhich elliptic curve you want: (1) Curve 25519 (3) NIST P-256 (4) NIST P-384 (5) NIST P-521 (6) Brainpool P-256 (7) Brainpool P-384 (8) Brainpool P-512 (9) secp256k1 Your selection? 1 Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y Really create? (y/N) y We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.
sec ed25519/910711ACF19A5FDF created: 2022-06-21 expires: never usage: C trust: ultimate validity: ultimate ssb ed25519/8A67550C0D04E806 created: 2022-06-21 expires: never usage: S ssb cv25519/4223A00DEEC08AC1 created: 2022-06-21 expires: never usage: E ssb ed25519/E70CE91D0116DFAE created: 2022-06-21 expires: never usage: A [ultimate] (1). Jing Li (Your Comment) <[email protected]>
gpg> addkey Please select what kind of key you want: (3) DSA (sign only) (4) RSA (sign only) (5) Elgamal (encrypt only) (6) RSA (encrypt only) (7) DSA (set your own capabilities) (8) RSA (set your own capabilities) (10) ECC (sign only) (11) ECC (set your own capabilities) (12) ECC (encrypt only) (13) Existing key (14) Existing key from card Your selection? 4 RSA keys may be between 1024 and 4096 bits long. What keysize do you want? (3072) 4096 Requested keysize is 4096 bits Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y Really create? (y/N) y We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.
sec ed25519/910711ACF19A5FDF created: 2022-06-21 expires: never usage: C trust: ultimate validity: ultimate ssb ed25519/8A67550C0D04E806 created: 2022-06-21 expires: never usage: S ssb cv25519/4223A00DEEC08AC1 created: 2022-06-21 expires: never usage: E ssb ed25519/E70CE91D0116DFAE created: 2022-06-21 expires: never usage: A ssb rsa4096/01F2DFEFE0D26D1F created: 2022-06-21 expires: never usage: S [ultimate] (1). Jing Li (Your Comment) <[email protected]>
# 缩写说明 A => Authentication C => Certify E => Encrypt S => Sign ? => Unknown capability sec => Secret Key ssb => Secret SuBkey pub => Public Key sub => Public Subkey
sec ed25519/910711ACF19A5FDF 2022-06-21 Jing Li (Your Comment) <[email protected]>
Create a revocation certificate for this key? (y/N) y Please select the reason for the revocation: 0 = No reason specified 1 = Key has been compromised 2 = Key is superseded 3 = Key is no longer used Q = Cancel (Probably you want to select 1 here) Your decision? 3 Enter an optional description; end it with an empty line: > Reason for revocation: Key is no longer used (No description given) Is this okay? (y/N) y Revocation certificate created.
Please move it to a medium which you can hide away; if Mallory gets access to this certificate he can use it to make your key unusable. It is smart to print this certificate and store it away, just incase your media become unreadable. But have some caution: The print system of your machine might store the data and make it available to others!
# 用 gpgsm 生成一个 X.509 证书 > gpgsm --gen-key -o temporary.cert gpgsm (GnuPG/MacGPG2) 2.2.34; Copyright (C) 2022 g10 Code GmbH This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
# 选择已有 key,利用上述 RSA 的 Subkey 进行转换 Please select what kind of key you want: (1) RSA (2) Existing key (3) Existing key from card Your selection? 2
Enter the keygrip: 8DA3C421E5AC294858D5EB0E16370052413AC9F2 Possible actions for a RSA key: (1) sign, encrypt (2) sign (3) encrypt # 我们希望这个证书仅用于签名 Your selection? 2
# 输入 X.509 的属性信息,这里 subject 缩写有一套规则 # 以下述为例,其他缩写请自行查找 X.509 subject C => countryName L => locality CN => commonName
Enter the X.509 subject name: C=China, L=Pingchao Nantong, CN=Jing Li Enter email addresses (end with an empty line): > [email protected] > Enter DNS names (optional; end with an empty line): > Enter URIs (optional; end with an empty line): >
# 生成自签名证书 Create self-signed certificate? (y/N) y These parameters are used: Key-Type: RSA Key-Length: 1024 Key-Grip: 8DA3C421E5AC294858D5EB0E16370052413AC9F2 Key-Usage: sign Serial: random Name-DN: C=China, L=Pingchao Nantong, CN=Jing Li Name-Email: [email protected]
Proceed with creation? (y/N) y Now creating self-signed certificate. This may take a while ... gpgsm: about to sign the certificate for key: &8DA3C421E5AC294858D5EB0E16370052413AC9F2 gpgsm: certificate created Ready. # 将上述新建证书导入到 gpgsm 的 Keyring > gpgsm --import temporary.cert