Main Menu

search

You are here

GPG - Single Password Protection

[last updated: 2023-07-04]
GnuPG Encryption home page
-----

  • Single password encryption:
    You might use this method if you just want to protect your files on your computer
    from being read by anyone who might get access to them,
    but you are not interested in sending the encrypted files to someone else.

    • Encrypt your file with:
            $ gpg -c -vv --cipher-algo AES256 [ file.txt ]
      the -c argument specifies "symmetric encryption"
          this means the same key is used to encrypt and decrypt your file
      the -vv specifies verbose output to check on the procedure as it executes
      the --cipher-algo AES256 specifies the stronger, 256-bit encryption
    • When you run this command, it will ask for you to create a password.
      You will also have a checkbox to select if you want your password to be saved in the "password manager."
          See: GPG password manager
      It will ask you to repeat the password to confirm, and will also warn you if your choice of password is weak.
    • It will create an encrypted file with the same filename, appended with a .gpg extension
      The original (unencrypted) file will remain, unchanged.
    • The ~/.gnupg directory will be created if it does not already exist.
      Several files are created in the ~/.gnupg directory
    • It appears you define a unique password for each file you encrypt,
      though of course you can choose to use the same password for many files.

    • Decrypt the file with:
            $ gpg [ file.txt ] .gpg
    • If you run this command on the same computer that you used to encrypt the file,
      you will not be prompted to enter the password
      (even if you declined to save your password in 'password manager').
      See: GPG password management for a way to change this.
    • If using a different computer, you'll need to enter the password.
    • When I ran this command, I got these messages:
        gpg: WARNING: no command supplied. Trying to guess what you mean ...
        gpg: AES256.CFB encrypted data
        gpg: encrypted with 1 passphrase

      Nevertheless, the command was successfully executed,
      and the original file was reconstituted.
      The encrypted ...gpg file remained.