|
|
| If you want to encrypt a directory instead of a file, use the gpg-zip tool: | | If you want to encrypt a directory instead of a file, use the gpg-zip tool: |
| | | |
| n | .. code-block: bash | n | .. code-block:: bash |
| | | |
| gpg-zip ~/home/user/secret-files > ~/home/user/secret-files.gpg-zip | | gpg-zip ~/home/user/secret-files > ~/home/user/secret-files.gpg-zip |
| If you want to use a single shared key use the --symmetric flag. It will prompt | | If you want to use a single shared key use the --symmetric flag. It will prompt |
| you for a password twice: | | you for a password twice: |
| | | |
| n | .. code-block: bash | n | .. code-block:: bash |
| | | |
| gpg-zip --symmetric ~/.password-store > password-store.gpg-zip | | gpg-zip --symmetric ~/.password-store > password-store.gpg-zip |
| t | | t | |
| | | |
| | | --list-archive: |
| | | List the contents of the specified archive. |
| | | |
| | | |
| Homework | | Homework |
|
|
| | | |
| | | |
| t | encrypt a directory | t | Encrypt a directory |
| =================== | | =================== |
| | | |
|
|
| | | |
| | | |
| t | | t | encrypt a directory |
| | | =================== |
| | | |
| | | If you want to encrypt a directory instead of a file, use the gpg-zip tool: |
| | | |
| | | .. code-block: bash |
| | | |
| | | gpg-zip ~/home/user/secret-files > ~/home/user/secret-files.gpg-zip |
| | | |
| | | If you want to use a single shared key use the --symmetric flag. It will prompt |
| | | you for a password twice: |
| | | |
| | | .. code-block: bash |
| | | |
| | | gpg-zip --symmetric ~/.password-store > password-store.gpg-zip |
| | | |
| Homework | | Homework |
| ============ | | ============ |
|
|
| gpg --delete-secret-key <KeyID> | | gpg --delete-secret-key <KeyID> |
| | | |
| n | | n | Edit and Trust a key |
| | | ==================== |
| | | |
| | | To edit a keys trust level (for instance to completely trust your own key) do th |
| | | e following: |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --edit-key <KeyID> |
| | | trust |
| | | 5 |
| | | y |
| | | |
| | | |
| Homework | | Homework |
| ============ | | ============ |
| * The keyring files are binary and exist in *~/.gnupg*. | | * The keyring files are binary and exist in *~/.gnupg*. |
| | | |
| t | | t | |
|
|
| gpg --delete-secret-key <KeyID> | | gpg --delete-secret-key <KeyID> |
| | | |
| n | | n | |
| Homework | | Homework |
| ============ | | ============ |
| #. re-import public and private key pair | | #. re-import public and private key pair |
| #. try to decrypt test file again | | #. try to decrypt test file again |
| t | | t | |
| | | Misc |
| | | ==== |
| | | |
| | | * The keyring files are binary and exist in *~/.gnupg*. |
| | | |
| | | |
|
|
| | | |
| | | |
| t | Create Key pair | t | Create a key pair |
| ================== | | ================== |
| | | |
|
|
| ============ | | ============ |
| | | |
| n | #. create a gpg keypair | n | #. create a gpg key pair |
| #. encrypt a test file | | #. encrypt a test file |
| #. decrypt a test file | | #. decrypt a test file |
| t | #. export public and private keypair | t | #. export public and private key pair |
| #. delete public and private keypair | | #. delete public and private key pair |
| #. re-import public and private keypair | | #. re-import public and private key pair |
| #. try to decrypt test file again | | #. try to decrypt test file again |
|
|
| | | |
| | | |
| t | Create GPG Keypair | t | Create Key pair |
| ================== | | ================== |
| | | |
|
|
| ########### | | ########### |
| | | |
| t | Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho | t | This document shows how to use the command line to work with PGP (GPG) for encry |
| w to encrypt a message as well as configuring "pass" password client for using t | | ption. |
| he keypair to protect passwords. | | |
| | | |
| This document does not use a GUI and only uses the command line. | | |
| | | |
| .. contents:: | | .. contents:: |
|
|
| gpg --delete-secret-key <KeyID> | | gpg --delete-secret-key <KeyID> |
| | | |
| t | | t | |
| | | Homework |
| | | ============ |
| | | |
| | | #. create a gpg keypair |
| | | #. encrypt a test file |
| | | #. decrypt a test file |
| | | #. export public and private keypair |
| | | #. delete public and private keypair |
| | | #. re-import public and private keypair |
| | | #. try to decrypt test file again |
|
|
| Then paste the encrypted message into the terminal. | | Then paste the encrypted message into the terminal. |
| | | |
| t | or optionally omit the 'encrypted message file' and paste the payload directly i | t | Optionally omit the 'encrypted message file' and paste the payload directly into |
| nto the cmd prompt. | | the cmd prompt. |
| | | |
| Export a public key | | Export a public key |
|
|
| ======================== | | ======================== |
| | | |
| t | To import a public key file: | t | |
| | | |
| .. code-block:: bash | | .. code-block:: bash |
| | | |
|
|
| | | |
| | | |
| n | Import a public key | n | Import a private key |
| ======================== | | ======================== |
| | | |
| .. code-block:: bash | | .. code-block:: bash |
| | | |
| t | gpg --allow-secret-key-import --import <public key file> | t | gpg --allow-secret-key-import --import <private key file> |
| | | |
| This adds the private key in the file to your private key ring. Alternatively yo | | This adds the private key in the file to your private key ring. Alternatively yo |
| u may omit the file and paste the private key directly to the command prompt. | | u may omit the file and paste the private key directly to the command prompt. |
|
|
| To export a public key for transportation or sharing, run this: | | To export a public key for transportation or sharing, run this: |
| | | |
| n | .. code-block:: | n | .. code-block:: bash |
| | | |
| gpg --export -a <KeyID> | | gpg --export -a <KeyID> |
| To export a private key for transportation or backup, run this: | | To export a private key for transportation or backup, run this: |
| | | |
| n | .. code-block:: | n | .. code-block:: bash |
| | | |
| gpg --export-secret-key -a <KeyID> | | gpg --export-secret-key -a <KeyID> |
| To import a public key file: | | To import a public key file: |
| | | |
| t | .. code-block:: | t | .. code-block:: bash |
| | | |
| gpg --import <public key file> | | gpg --import <public key file> |
|
|
| ======================== | | ======================== |
| | | |
| n | .. code-block:: | n | .. code-block:: bash |
| | | |
| gpg --allow-secret-key-import --import <public key file> | | gpg --allow-secret-key-import --import <public key file> |
| | | |
| This adds the private key in the file to your private key ring. Alternatively yo | | This adds the private key in the file to your private key ring. Alternatively yo |
| u may omit the file and paste the private key directly to the command prompt. | | u may omit the file and paste the private key directly to the command prompt. |
| t | | t | |
| | | Delete a public key |
| | | ===================== |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --delete-key <KeyID> |
| | | |
| | | Delete a private key |
| | | ===================== |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --delete-secret-key <KeyID> |
| | | |
|
|
| | | |
| or optionally omit the 'encrypted message file' and paste the payload directly i | | or optionally omit the 'encrypted message file' and paste the payload directly i |
| nto the cmd prompt. | | nto the cmd prompt. |
| t | | t | |
| | | Export a public key |
| | | ======================== |
| | | |
| | | To export a public key for transportation or sharing, run this: |
| | | |
| | | .. code-block:: |
| | | |
| | | gpg --export -a <KeyID> |
| | | |
| | | This will output the public key for a given KeyID as ascii, which may be shared |
| | | and distributed to anyone. |
| | | |
| | | Export a private key |
| | | ======================== |
| | | |
| | | To export a private key for transportation or backup, run this: |
| | | |
| | | .. code-block:: |
| | | |
| | | gpg --export-secret-key -a <KeyID> |
| | | |
| | | This will output the private key for a given KeyID as ascii, which must be safel |
| | | y gaurded. |
| | | |
| | | Import a public key |
| | | ======================== |
| | | |
| | | To import a public key file: |
| | | |
| | | .. code-block:: |
| | | |
| | | gpg --import <public key file> |
| | | |
| | | This adds the public key in the file to your public key ring. Alternatively you |
| | | may omit the file and paste the public key directly to the command prompt. |
| | | |
| | | |
| | | Import a public key |
| | | ======================== |
| | | |
| | | .. code-block:: |
| | | |
| | | gpg --allow-secret-key-import --import <public key file> |
| | | |
| | | This adds the private key in the file to your private key ring. Alternatively yo |
| | | u may omit the file and paste the private key directly to the command prompt. |
|
|
| .. code-block:: bash | | .. code-block:: bash |
| | | |
| t | gpg -d <encrypted message file> | t | gpg -d <encrypted asc message file> |
| | | |
| Then paste the encrypted message into the terminal. | | Then paste the encrypted message into the terminal. |
|
|
| It will prompt for a passphrase three times unless a valid one is submitted, the | | It will prompt for a passphrase three times unless a valid one is submitted, the |
| n it will allow you to write an encrypted message. press ctrl-d to end the mess | | n it will allow you to write an encrypted message. press ctrl-d to end the mess |
| age. | | age. |
| | | |
| t | | t | Alternatively you may encrypt any file (text or binary) using a command like thi |
| | | s: |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --local-user <KEYID> -as <file> |
| | | |
| | | This will prompt for your passphrase and on success generate an 'asc' file. |
| | | |
| | | For example, lets encrypt the fake test file 'secret-raw-payload.txt' using the |
| | | following command: |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --local-user MYKEYID1 -as secret-raw-payload.txt |
| | | |
| | | |
| Decrypt a test message | | Decrypt a test message |
| ============================== | | ============================== |
|
|
| | | |
| This document does not use a GUI and only uses the command line. | | This document does not use a GUI and only uses the command line. |
| t | | t | |
| | | .. contents:: |
| | | |
| | | |
| | | |
| Create GPG Keypair | | Create GPG Keypair |
|
|
| It will prompt for a passphrase three times unless a valid one is submitted, the | | It will prompt for a passphrase three times unless a valid one is submitted, the |
| n it will allow you to write an encrypted message. press ctrl-d to end the mess | | n it will allow you to write an encrypted message. press ctrl-d to end the mess |
| age. | | age. |
| | | |
| t | decrypt the test message | t | Decrypt a test message |
| ============================== | | ============================== |
| | | |
|
|
| Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho | | Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho |
| w to encrypt a message as well as configuring "pass" password client for using t | | w to encrypt a message as well as configuring "pass" password client for using t |
| he keypair to protect passwords. | | he keypair to protect passwords. |
| | | |
| t | Creating GPG Keys Using the Command Line | t | This document does not use a GUI and only uses the command line. |
| ========================================== | | |
| | | Create GPG Keypair |
| | | ================== |
| | | |
| Use the following shell command: | | Use the following shell command: |
|
|
| gpg --list-keys | | gpg --list-keys |
| | | |
| n | Validate a GPG passphrase and encrypt a test message | n | Encrypt a test message |
| ========================================================= | | ========================================================= |
| t | | t | |
| | | This process may also be used to Validate a private key passphrase. |
| | | |
| .. code-block:: bash | | .. code-block:: bash |
|
|
| Also memorize your long passphrase and never tell anyone it, ever. | | Also memorize your long passphrase and never tell anyone it, ever. |
| | | |
| n | Document your new <keyid> | n | Document your new 'KeyID'. |
| | | |
| t | Determine KeyID | t | List all keys |
| =================== | | ============================= |
| | | |
| | | This is a great way to determine a 'KeyID' |
| | | |
| .. code-block:: bash | | .. code-block:: bash |
|
|
| .. code-block:: bash | | .. code-block:: bash |
| | | |
| n | gpg -d | n | gpg -d <encrypted message file> |
| | | |
| Then paste the encrypted message into the terminal. | | Then paste the encrypted message into the terminal. |
| t | | t | |
| | | or optionally omit the 'encrypted message file' and paste the payload directly i |
| | | nto the cmd prompt. |
|
|
| It will prompt for a passphrase three times unless a valid one is submitted, the | | It will prompt for a passphrase three times unless a valid one is submitted, the |
| n it will allow you to write an encrypted message. press ctrl-d to end the mess | | n it will allow you to write an encrypted message. press ctrl-d to end the mess |
| age. | | age. |
| | | |
| t | | t | decrypt the test message |
| | | ============================== |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg -d |
| | | |
| | | Then paste the encrypted message into the terminal. |
|
|
| Also memorize your long passphrase and never tell anyone it, ever. | | Also memorize your long passphrase and never tell anyone it, ever. |
| | | |
| t | | t | Document your new <keyid> |
| | | |
| | | Determine KeyID |
| | | =================== |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --list-keys |
| | | |
| | | Validate a GPG passphrase and encrypt a test message |
| | | ========================================================= |
| | | |
| | | .. code-block:: bash |
| | | |
| | | gpg --local-user <KEYID> -as |
| | | |
| | | It will prompt for a passphrase three times unless a valid one is submitted, the |
| | | n it will allow you to write an encrypted message. press ctrl-d to end the mess |
| | | age. |
| | | |
|
|
| | | |
| Answer the prompts, I typically accept all defaults which is 2048 bits and RSA. | | Answer the prompts, I typically accept all defaults which is 2048 bits and RSA. |
| t | | t | Also memorize your long passphrase and never tell anyone it, ever. |
| | | |
| | | |
|
|
| Use the following shell command: | | Use the following shell command: |
| | | |
| t | .. code-block:: | t | .. code-block:: bash |
| | | |
| gpg --gen-key | | gpg --gen-key |
|
|
| t | | t | Linux GPG |
| | | ########### |
| | | |
| | | Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho |
| | | w to encrypt a message as well as configuring "pass" password client for using t |
| | | he keypair to protect passwords. |
| | | |
| | | Creating GPG Keys Using the Command Line |
| | | ========================================== |
| | | |
| | | Use the following shell command: |
| | | |
| | | .. code-block:: |
| | | |
| | | gpg --gen-key |
| | | |
| | | Answer the prompts, I typically accept all defaults which is 2048 bits and RSA. |
| | | |
| | | |