Differences
This shows you the differences between two versions of the page.
— | gpg [2017/07/21 21:56] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== GPG ====== | ||
+ | * [[http:// | ||
+ | |||
+ | === Create a GPG key === | ||
+ | |||
+ | < | ||
+ | |||
+ | Running this will call pinentry in ncurses mode (if used on a remote connection), | ||
+ | |||
+ | === Export your public key === | ||
+ | |||
+ | You need to give your public key to others so that they can use GPG to encrypt files that only you can decrypt. | ||
+ | |||
+ | < | ||
+ | |||
+ | === Import a public key === | ||
+ | |||
+ | You will want to import someone else's public key before you can encrypt a file with them as the recipient. | ||
+ | |||
+ | < | ||
+ | |||
+ | === Encrypt a file === | ||
+ | |||
+ | < | ||
+ | |||
+ | The file created will be '' | ||
+ | |||
+ | You can also encrypt a file for multiple recipients, including yourself. | ||
+ | |||
+ | < | ||
+ | |||
+ | == Signing Keys == | ||
+ | |||
+ | If the recipient is someone other than yourself, then you will get a message that says "There is no assurance this key belongs to the named user ..." and it will ask you to verify the key. | ||
+ | |||
+ | If you want to always be able to sign for that recipient without verifying it, you can sign the key: | ||
+ | |||
+ | < | ||
+ | |||
+ | == Listing Keys == | ||
+ | |||
+ | You can get the recipient email and key IDs by listing the keys: | ||
+ | |||
+ | < | ||
+ | |||
+ | Note that if you start to list a key with a partial address, it will still accept that input and list the key. | ||
+ | |||
+ | Fex, '' | ||
+ | |||
+ | For scripting, display keys: | ||
+ | |||
+ | < | ||
+ | gpg -k | grep ^uid | sed -e ' | ||
+ | </ | ||
+ | |||
+ | Also, use --keyid-format to display it one of the (many) possible formats | ||
+ | |||
+ | < | ||
+ | --keyid-format none|short|0xshort|long|0xlong | ||
+ | </ | ||
+ | |||
+ | === Decrypt a file === | ||
+ | |||
+ | < | ||
+ | |||
+ | GPG will output some text while decrypting. It may ask you for your passphrase as well. Again, make sure you are not running in screen. | ||
+ | |||
+ | === Batch Mode === | ||
+ | |||
+ | GPG, by default, will ask if you want to overwrite a file. This can wreak havoc on scripts or pipes. | ||
+ | |||
+ | You can overwite a file with these commands: | ||
+ | |||
+ | < | ||
+ | gpg --yes --batch -r [email protected] -e -o foo.txt.gpg | ||
+ | </ | ||
+ | |||
+ | === Generate Entropy === | ||
+ | |||
+ | < | ||
+ | rngd -r / | ||
+ | </ |