Skip to content

Instantly share code, notes, and snippets.

@vanderw
Last active March 22, 2025 08:04
Show Gist options
  • Save vanderw/c9c8a0546a4d000710c500a6d43b3144 to your computer and use it in GitHub Desktop.
Save vanderw/c9c8a0546a4d000710c500a6d43b3144 to your computer and use it in GitHub Desktop.
File encryption / decryption commands (Better fit linux users)

GnuPG

Heard of that GPG is a "Better alternative" than OpenSSL.

# encryption
# this will prompt you password input & confirm
gpg --output encrypted.data --symmetric --cipher-algo AES256 un_encrypted.data

# decryption
# Never need you input password.(By default) this is why i don't think it is "Better"
gpg --output un_encrypted.data --decrypt encrypted.data

OpenSSL

# encryption
openssl aes-256-cbc -a -salt -pbkdf2 -iter 20000 -in secrets.txt -out secrets.txt.enc
# decryption
openssl aes-256-cbc -d -a -pbkdf2 -iter 20000 -in secrets.txt.enc -out secrets.txt.new

OpenSSL is better. It's IMPORTANT to verify password EVERYTIME for ANYONE try to decrypt your secrets.

Reference

stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment