gpg (GnuPG) 2.2.4; Copyright (C) 2017 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, tothe 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) Your selection? RSA keys may be between 1024and4096 bits long. What keysize do you want? (3072) Requested keysize is 3072 bits Please specify how longthe 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: Gavin Gao Email address: cggos@outlook.com Comment: You selected this USER-ID: "Gavin Gao <cggos@outlook.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o We need to generate a lot ofrandombytes. It is a good idea to perform some other action (type onthekeyboard, movethemouse, utilizethe disks) during the prime generation; this gives therandomnumber generator a better chance to gain enough entropy. We need to generate a lot ofrandombytes. It is a good idea to perform some other action (type onthekeyboard, movethemouse, utilizethe disks) during the prime generation; this gives therandomnumber generator a better chance to gain enough entropy. gpg: key 94FB606ACFB828F6 marked as ultimately trusted gpg: directory'/home/cg/.gnupg/openpgp-revocs.d' created gpg: revocation certificate stored as'/home/cg/.gnupg/openpgp-revocs.d/D06142ABCC08402AFCDB2FAF94FB606ACFB828F6.rev' public and secret key created and signed.
gpg (GnuPG) 2.2.4; Copyright (C) 2017 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.
Secret key is available.
sec rsa3072/94FB606ACFB828F6 created: 2022-04-28 expires: never usage: SC trust: ultimate validity: ultimate ssb rsa3072/BB0088AB554CF92D created: 2022-04-28 expires: never usage: E [ultimate] (1). Gavin Gao <cggos@outlook.com>
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) Your selection? 4 RSA keys may be between1024and4096 bits long. What keysize do you want? (3072) Requested keysize is3072 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 Keyis 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 (typeon 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 rsa3072/94FB606ACFB828F6 created: 2022-04-28 expires: never usage: SC trust: ultimate validity: ultimate ssb rsa3072/BB0088AB554CF92D created: 2022-04-28 expires: never usage: E ssb rsa3072/3384DE02354CC62E created: 2022-04-28 expires: never usage: S [ultimate] (1). Gavin Gao <cggos@outlook.com>
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 = Keyis superseded 3 = Keyis no longer used Q = Cancel (Probably you want toselect1 here) Your decision? Enter an optional description; end it with an empty line: > Reason for revocation: Key has been compromised (No description given) Is this okay? (y/N) y ASCII armored output forced. -----BEGIN PGP PUBLICKEY BLOCK----- Comment: This is a revocation certificate
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!
gpg (GnuPG) 2.2.4; Copyright (C) 2017 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.
gpg: data source: https://keys.openpgp.org:443 (1) Gavin Gao <cggos@outlook.com> 3072 bit RSA key 94FB606ACFB828F6, created: 2022-04-28 Keys 1-1 of 1for"94FB606ACFB828F6". Enter number(s), N)ext, or Q)uit > N
gpg:key94FB606ACFB828F6: publickey"Gavin Gao <cggos@outlook.com>" imported gpg: Total number processed: 1 gpg: imported: 1
Keybase
1
keybase pgp select
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
You are selecting a PGP keyfrom your local GnuPG keychain, and will publish a statement signed with this keyto make it part of your Keybase.io identity.
Note that GnuPG will prompt you to perform this signature.
You can also import the secret keyto *local*, *encrypted* Keybase keyring, enabling decryption and signing with the Keybase client. Todo that, use "--import" flag.
Learn more: keybase pgp help select
# Algo Key Id Created UserId = ==== ====== ======= ====== 13072R 94FB606ACFB828F6 Gavin Gao <cggos@outlook.com> Choose a key: 1 ▶ INFO Generated new PGP key: ▶ INFO user: Gavin Gao <cggos@outlook.com> ▶ INFO 3072-bit RSA key, ID 94FB606ACFB828F6, created 2022-04-28
应用
文件验证
签名
1
gpg --detach-signdemo.txt
验证
1
gpg --verify demo.txt.sig demo.txt
1 2 3 4 5 6 7
gpg: Signature made Thu 28 Apr 202208:14:27 PM CST gpg: using RSA key C8BA9D0647339A178B7545F03384DE02354CC62E gpg: Good signature from "Gavin Gao <cggos@outlook.com>" [unknown] gpg: WARNING: This key isnot certified with a trusted signature! gpg: There isno indication that the signature belongs to the owner. Primary key fingerprint: D061 42AB CC08 402A FCDB 2FAF 94FB 606A CFB8 28F6 Subkey fingerprint: C8BA 9D06 47339A17 8B75 45F0 3384 DE02 354C C62E
gpg (GnuPG) 2.2.4; Copyright (C) 2017 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 rsa3072/94FB606ACFB828F6 created: 2022-04-28 expires: never usage: SC trust: unknown validity: unknown sub rsa3072/3384DE02354CC62E created: 2022-04-28 expires: never usage: S sub rsa3072/BB0088AB554CF92D created: 2022-04-28 expires: never usage: E [ unknown] (1). Gavin Gao <cggos@outlook.com>
gpg> trust pub rsa3072/94FB606ACFB828F6 created: 2022-04-28 expires: never usage: SC trust: unknown validity: unknown sub rsa3072/3384DE02354CC62E created: 2022-04-28 expires: never usage: S sub rsa3072/BB0088AB554CF92D created: 2022-04-28 expires: never usage: E [ unknown] (1). Gavin Gao <cggos@outlook.com>
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 rsa3072/94FB606ACFB828F6 created: 2022-04-28 expires: never usage: SC trust: ultimate validity: unknown sub rsa3072/3384DE02354CC62E created: 2022-04-28 expires: never usage: S sub rsa3072/BB0088AB554CF92D created: 2022-04-28 expires: never usage: E [ unknown] (1). Gavin Gao <cggos@outlook.com> Please note that the shown key validity is not necessarily correct unless you restart the program.