| Line 9: |
Line 9: |
| | ====Encrypt & Sign==== | | ====Encrypt & Sign==== |
| | gpg --encrypt --sign --recipient 'some user ID value' <file> | | gpg --encrypt --sign --recipient 'some user ID value' <file> |
| | + | |
| | + | ====Encrypt without prompt for key verification==== |
| | + | gpg --trust-model always --encrypt --recipient rafael@herrerosolis.com secret_file.txt |
| | | | |
| | ===Decryption=== | | ===Decryption=== |
| Line 33: |
Line 36: |
| | gpg --export-secret-key -a "User Name" > private.key | | gpg --export-secret-key -a "User Name" > private.key |
| | | | |
| − | ==== Change private key passphrase ==== | + | ====Change private key passphrase==== |
| | <syntaxhighlight lang="text"> | | <syntaxhighlight lang="text"> |
| | user@machine:~$ gpg --list-secret-keys | | user@machine:~$ gpg --list-secret-keys |
| Line 64: |
Line 67: |
| | gpg> passwd | | gpg> passwd |
| | | | |
| | + | </syntaxhighlight> |
| | + | |
| | + | ====Delete Private Key==== |
| | + | <syntaxhighlight lang="bash"> |
| | + | gpg --delete-secret-key 8167B416B55E2859 |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| Line 71: |
Line 79: |
| | =====To file===== | | =====To file===== |
| | gpg --output <destination_file.gpg> --export <public_key_ID> | | gpg --output <destination_file.gpg> --export <public_key_ID> |
| | + | |
| | + | =====Export all public keys===== |
| | + | <syntaxhighlight lang="bash"> |
| | + | gpg --list-keys | grep -v "pub\|sub\|uid\|--" | sed '/^$/d' | xargs -t -n 1 -I ARG gpg --export --armor ARG |
| | + | </syntaxhighlight> |
| | + | |
| | =====To server===== | | =====To server===== |
| | gpg --send-keys --keyserver pgp.mit.edu 18384645 | | gpg --send-keys --keyserver pgp.mit.edu 18384645 |
| Line 81: |
Line 95: |
| | =====From server===== | | =====From server===== |
| | gpg --keyserver pgp.mit.edu --recv-keys 18384645 | | gpg --keyserver pgp.mit.edu --recv-keys 18384645 |
| | + | |
| | + | ====Delete Public Key==== |
| | + | <syntaxhighlight lang="bash"> |
| | + | gpg --delete-key 8167B416B55E2859 |
| | + | </syntaxhighlight> |
| | | | |
| | ===Encrypt with a public key=== | | ===Encrypt with a public key=== |
| Line 91: |
Line 110: |
| | ====Encrypt to multiple recipients==== | | ====Encrypt to multiple recipients==== |
| | <nowiki>gpg --recipient 42FF42FF \ | | <nowiki>gpg --recipient 42FF42FF \ |
| − | --recipient 12345678 \
| + | --recipient 12345678 \ |
| − | --recipient FEFEFEFE \
| + | --recipient FEFEFEFE \ |
| − | --encrypt-files backup.tar</nowiki>
| + | --encrypt-files backup.tar</nowiki> |
| | + | |
| | + | ====Encrypt without recipient key verification prompt==== |
| | + | <syntaxhighlight lang="bash"> |
| | + | gpg --trust-model always --encrypt --recipient rafael@herrerosolis.com secret_file.txt |
| | + | </syntaxhighlight> |
| | + | |
| | + | ====Encrypt without prompt for key verification==== |
| | + | gpg --trust-model always --encrypt --recipient rafael@herrerosolis.com secret_file.txt |
| | | | |
| | ===Decrypt with private key=== | | ===Decrypt with private key=== |
| | comando gpg -d <encrypted_file> | | comando gpg -d <encrypted_file> |
| | | | |
| | + | === List keys that can decrypt some file === |
| | + | <syntaxhighlight lang="bash"> |
| | + | gpg --list-only --no-default-keyring file.gpg |
| | + | </syntaxhighlight><br /> |
| | ===Signing Keys=== | | ===Signing Keys=== |
| | [https://www.phildev.net/pgp/gpgsigning.html Sign keys] | | [https://www.phildev.net/pgp/gpgsigning.html Sign keys] |