| Line 1: |
Line 1: |
| − | == GnuPG == | + | ==GnuPG== |
| − | == Simetric Cipher == | + | ==Simetric Cipher== |
| − | === Encryption === | + | ===Encryption=== |
| | gpg -c file.txt | | gpg -c file.txt |
| | we will be prompt for a password.<br /> | | we will be prompt for a password.<br /> |
| Line 7: |
Line 7: |
| | gpg -ca file.txt | | gpg -ca file.txt |
| | If we want an ascii output | | If we want an ascii output |
| − | ==== Encrypt & Sign ==== | + | ====Encrypt & Sign==== |
| | gpg --encrypt --sign --recipient 'some user ID value' <file> | | gpg --encrypt --sign --recipient 'some user ID value' <file> |
| | | | |
| − | === Decryption === | + | ===Decryption=== |
| | gpg -d file.txt | | gpg -d file.txt |
| | gpg --output <file> --decrypt <encrypted-and-signed-file> | | gpg --output <file> --decrypt <encrypted-and-signed-file> |
| Line 16: |
Line 16: |
| | we will be prompt for a password. | | we will be prompt for a password. |
| | | | |
| − | == Asimetric Cipher == | + | ==Asimetric Cipher== |
| − | === Generate keys === | + | ===Generate keys=== |
| | gpg --default-new-key-algo rsa4096 --gen-key | | gpg --default-new-key-algo rsa4096 --gen-key |
| | gpg --gen-key | | gpg --gen-key |
| | | | |
| − | === List private keys === | + | ===List private keys=== |
| | gpg --list-secret-keys | | gpg --list-secret-keys |
| − | === Export private key === | + | ===Export private key=== |
| | gpg --export-secret-key -a "User Name" > private.key | | gpg --export-secret-key -a "User Name" > private.key |
| − | === Export public key === | + | ===Export public key=== |
| − | ==== To file ==== | + | ====To file==== |
| | gpg --output <destination_file.gpg> --export <public_key_ID> | | gpg --output <destination_file.gpg> --export <public_key_ID> |
| − | ==== To server ==== | + | ====To server==== |
| | gpg --send-keys --keyserver pgp.mit.edu 18384645 | | gpg --send-keys --keyserver pgp.mit.edu 18384645 |
| − | ==== To ascii file ==== | + | ====To ascii file==== |
| | gpg --armor --export you@example.com > mykey.asc | | gpg --armor --export you@example.com > mykey.asc |
| | | | |
| − | === Import secret keys === | + | ===Import secret keys=== |
| | gpg --allow-secret-key-import --import tmp.asc | | gpg --allow-secret-key-import --import tmp.asc |
| − | === Import public keys === | + | ===Import public keys=== |
| − | ==== From file ==== | + | ====From file==== |
| | gpg --import <publickeyfile.gpg> | | gpg --import <publickeyfile.gpg> |
| − | ==== From server ==== | + | ====From server==== |
| | gpg --keyserver pgp.mit.edu --recv-keys 18384645 | | gpg --keyserver pgp.mit.edu --recv-keys 18384645 |
| | | | |
| − | === Encrypt with a public key === | + | ===Encrypt with a public key=== |
| − | ==== List public keys ==== | + | ====List public keys==== |
| | gpg --list-keys | | gpg --list-keys |
| − | ==== Encrypt one recipient ==== | + | ====Encrypt one recipient==== |
| | gpg --recipient <key ID> --encrypt <file> | | gpg --recipient <key ID> --encrypt <file> |
| − | == Encrypt with ascii output == | + | ==Encrypt with ascii output== |
| | gpg --armor --encrypt --output ~/test.crypt --recipient redteam@bbva.com ~/test.txt | | gpg --armor --encrypt --output ~/test.crypt --recipient redteam@bbva.com ~/test.txt |
| − | ==== 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> |
| | | | |
| − | === Decrypt with private key === | + | ===Decrypt with private key=== |
| | comando gpg -d <encrypted_file> | | comando gpg -d <encrypted_file> |
| | | | |
| − | === Signing === | + | === Signing Keys === |
| − | ==== Sign ==== | + | [https://www.phildev.net/pgp/gpgsigning.html Sign keys] |
| | + | |
| | + | ===Signing=== |
| | + | ====Sign==== |
| | gpg -u <private_Key_ID> --output <output_signed_file> --sign <file_to_sign> | | gpg -u <private_Key_ID> --output <output_signed_file> --sign <file_to_sign> |
| | gpg --local-user <private_Key_ID> --output <output_signed_file> --sign <file_to_sign> | | gpg --local-user <private_Key_ID> --output <output_signed_file> --sign <file_to_sign> |
| | | | |
| − | ==== Verify signature ==== | + | ====Verify signature==== |
| | gpg -d <signed_file> | | gpg -d <signed_file> |
| | or | | or |
| | gpg --verify <signed_file> | | gpg --verify <signed_file> |
| | | | |
| − | == CheatSheet == | + | ==CheatSheet== |
| | [http://wiki.herrerosolis.com/images/1/1e/Gpg_cheat_sheet.tar.gz Gpg_cheat_sheet.tar.gz]<br /> | | [http://wiki.herrerosolis.com/images/1/1e/Gpg_cheat_sheet.tar.gz Gpg_cheat_sheet.tar.gz]<br /> |
| | https://www.digitalocean.com/community/tutorials/how-to-use-gpg-to-encrypt-and-sign-messages<br /> | | https://www.digitalocean.com/community/tutorials/how-to-use-gpg-to-encrypt-and-sign-messages<br /> |
| | http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/ | | http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/ |