$ gpg --full-generate-key gpg (GnuPG) 2.2.40; 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) (14) Existing key from card Your selection? 1 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) 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: test1 Email address: test1@foo.bar Comment: test1's PGP key You selected this USER-ID: "test1 (test1's PGP key) <test1@foo.bar>"
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. 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 '/home/littleye233/.gnupg/openpgp-revocs.d/EB28C6D42ACFC1798DC7D1CB46D85BAE755DB198.rev' public and secret key created and signed.
gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: EB28 C6D4 2ACF C179 8DC7 D1CB 46D8 5BAE 755D B198
$ gpg --edit-key test1@foo.bar gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
pub rsa4096/46D85BAE755DB198 created: 2022-12-09 expires: never usage: SC trust: full validity: unknown sub rsa4096/EEAD650E9DE15AB8 created: 2022-12-09 expires: never usage: E [ unknown] (1). test1 (test1's PGP key) <test1@foo.bar> gpg> trust pub rsa4096/46D85BAE755DB198 created: 2022-12-09 expires: never usage: SC trust: full validity: unknown sub rsa4096/EEAD650E9DE15AB8 created: 2022-12-09 expires: never usage: E [ unknown] (1). test1 (test1's PGP key) <test1@foo.bar>
Please decide how far you trust this user to correctly verify other users' keys (by looking at passports, checking fingerprints from different sources, etc.)
1 = I don't know or won't say 2 = I do NOT trust 3 = I trust marginally 4 = I trust fully 5 = I trust ultimately m = back to the main menu
Your decision? 5 Do you really want to set this key to ultimate trust? (y/N) y
pub rsa4096/46D85BAE755DB198 created: 2022-12-09 expires: never usage: SC trust: ultimate validity: unknown sub rsa4096/EEAD650E9DE15AB8 created: 2022-12-09 expires: never usage: E [ unknown] (1). test1 (test1's PGP key) <test1@foo.bar> Please note that the shown key validity is not necessarily correct unless you restart the program. gpg> q
$ gpg --decrypt message.txt.asc CjYIdc["Ns`3[BA\=5#+TM<[ORUhQ|i-E>!S0e!hc_A'R_h!9SU2v$oJ2SIKGp"l gpg: encrypted with RSA key, ID EEAD650E9DE15AB8 gpg: encrypted with 4096-bit RSA key, ID 9C0A6E908BC7D25D, created 2022-12-09 "test2 (test2's PGP key) <test2@foo.bar>"
对于已签名的加密信息, 在信息发送者的公钥未导入时, 此时无法检查签名, 可能的输出如下:
1 2 3 4 5 6 7 8
$ gpg --decrypt message.txt.asc CjYIdc["Ns`3[BA\=5#+TM<[ORUhQ|i-E>!S0e!hc_A'R_h!9SU2v$oJ2SIKGp"l gpg: encrypted with 4096-bit RSA key, ID 9C0A6E908BC7D25D, created 2022-12-09 "test2 (test2's PGP key) <test2@foo.bar>" gpg: Signature made Fri 09 Dec 2022 04:25:43 PM UTC gpg: using RSA key EB28C6D42ACFC1798DC7D1CB46D85BAE755DB198 gpg: issuer "test1@foo.bar" gpg: Can't check signature: No public key
$ gpg --verify message.txt.asc message.txt gpg: Signature made Sat 10 Dec 2022 12:46:26 AM CST gpg: using RSA key EB28C6D42ACFC1798DC7D1CB46D85BAE755DB198 gpg: Good signature from "test1 (test1's PGP key) <test1@foo.bar>" [ultimate]