2021-01-04 22:59:33 +00:00
|
|
|
# gpg2
|
2019-06-03 22:02:45 +01:00
|
|
|
|
|
|
|
> GNU Privacy Guard 2.
|
2021-01-04 22:59:33 +00:00
|
|
|
> See `gpg` for GNU Privacy Guard 1.
|
2019-06-03 22:02:45 +01:00
|
|
|
> More information: <https://docs.releng.linuxfoundation.org/en/latest/gpg.html>.
|
|
|
|
|
|
|
|
- List imported keys:
|
|
|
|
|
|
|
|
`gpg2 --list-keys`
|
|
|
|
|
|
|
|
- Encrypt a specified file for a specified recipient, writing the output to a new file with `.gpg` appended:
|
|
|
|
|
|
|
|
`gpg2 --encrypt --recipient {{alice@example.com}} {{path/to/doc.txt}}`
|
|
|
|
|
|
|
|
- Encrypt a specified file with only a passphrase, writing the output to a new file with `.gpg` appended:
|
|
|
|
|
|
|
|
`gpg2 --symmetric {{path/to/doc.txt}}`
|
|
|
|
|
2023-08-09 06:29:02 +01:00
|
|
|
- Decrypt a specified file, writing the result to `stdout`:
|
2019-06-03 22:02:45 +01:00
|
|
|
|
|
|
|
`gpg2 --decrypt {{path/to/doc.txt.gpg}}`
|
|
|
|
|
|
|
|
- Import a public key:
|
|
|
|
|
|
|
|
`gpg2 --import {{path/to/public_key.gpg}}`
|
|
|
|
|
2023-08-09 06:29:02 +01:00
|
|
|
- Export the public key of a specified email address to `stdout`:
|
2019-06-03 22:02:45 +01:00
|
|
|
|
|
|
|
`gpg2 --export --armor {{alice@example.com}}`
|
|
|
|
|
2023-08-09 06:29:02 +01:00
|
|
|
- Export the private key with a specified email address to `stdout`:
|
2019-06-03 22:02:45 +01:00
|
|
|
|
|
|
|
`gpg2 --export-secret-keys --armor {{alice@example.com}}`
|