In Ruan one peak great God's blog (http://www.ruanyifeng.com/blog/2013/07/gpg.html) goes to school gpg. Here after the practice of the record, in fact, mainly changed the layout, convenient for personal use.
The key file is saved under ~/.gunpg/
Encryption: (Requires the system to have each other's public key)
GPG--recipient [user ID]--output sec.txt--encrypt source.txt
Decryption: (determines that the encrypted file is encrypted with its own public key)
GPG Sec.txt
Signature:
Signature only not encrypted:
Signature Instructions |
The resulting signature file |
Notes |
Validation Directives |
GPG--sign Source.txt |
Source.txt.gpg |
Binary form storage, including file content; |
GPG--verify SOURCE.TXT.GPG |
GPG--clearsign Source.txt |
Source.txt.asc |
Text Form Storage; |
GPG--verify SOURCE.TXT.ASC |
GPG--detach-sign Source.txt |
Source.txt.sig |
binary form storage; does not contain the content of the file; if the filename is not standard, it should be specified; |
GPG--verify Source.txt.sig |
GPG--armor--detach-sign Source.txt |
Source.txt.asc |
Text storage, no file content, if the file name is not standard when verifying; |
GPG--verify SOURCE.TXT.ASC |
Signature and encryption: (Decrypt the file when it is received and then obtain the decryption file and verify the signature)
GPG--local-user [Sender ID]--recipient [recipient ID]--armor--sign--encrypt source.txt
Verify:
GPG--verify SOURCE.TXT.ASC Source.txt
Lists the system's existing keys
GPG--list-keys
Delete a key
GPG--delete-key [user ID]
Find someone else's public key on a public key server (no guarantee that the public key is reliable and need to be validated by another mechanism after downloading)
GPG--keyserver hkp://subkeys.pgp.net--search-keys [user ID]
Import Key
GPG--import [key file]
Export a public/private key and display it in ASCII
GPG--armor--output public-key.txt--export [user ID] gpg--armor--output private-key.txt