Age in Termux – Encrypt and Decrypt Files

Age is a command-line file encryption tool that lets you encrypt and decrypt files from the terminal. It supports public key encryption and passphrase-based encryption. You can also encrypt files for multiple recipients and save the encrypted output to a separate file.

Here’s what you can do with Age tool in Termux:

  • Encrypt files using a public key.
  • Decrypt files using a private key.
  • Protect files with a passphrase.
  • Generate public and private key pairs.
  • Encrypt files for multiple recipients.
  • Read recipients from a file.
  • Use identity files to decrypt encrypted data.
  • Create ASCII-armored encrypted output.
  • Encrypt and decrypt data through standard input and output.

Install Age in Termux

You can install Age in Termux with a single command. Open Termux and run the command below to start the installation.

First, update and upgrade the packages:

pkg update && pkg upgrade -y

Now, Install Age:

pkg install age -y

Once the installation is complete, Age is ready to use in your Termux terminal.

Use Age in Termux

You can use the following Age commands to encrypt files, decrypt protected data, generate keys, and manage different encryption options in Termux.

Generate a new key pair:

age-keygen -o key.txt

This creates a private key file named key.txt and displays your public key in the terminal.

Encrypt a file using a public key:

age -r YOUR_PUBLIC_KEY -o secret.txt.age secret.txt

Replace YOUR_PUBLIC_KEY with your actual public key and secret.txt with the name of your file.

Decrypt an encrypted file:

age -d -i key.txt -o secret.txt secret.txt.age

Encrypt a file using a passphrase:

age -p -o secret.txt.age secret.txt

Decrypt a passphrase-protected file:

age -d -o secret.txt secret.txt.age

Age will ask for the passphrase before decrypting the file.

Encrypt a file in ASCII-armored format:

age -a -r YOUR_PUBLIC_KEY -o secret.txt.age secret.txt

Encrypt a file for multiple recipients:

age -r RECIPIENT_1 -r RECIPIENT_2 -o secret.txt.age secret.txt

Encrypt using a recipients file:

age -R recipients.txt -o secret.txt.age secret.txt

Decrypt using multiple identity files:

age -i key1.txt -i key2.txt -d -o secret.txt secret.txt.age

Encrypt data from standard input:

echo "Hello World" | age -p > message.age

Decrypt data and display the output in the terminal:

age -d -i key.txt message.age

Display the help menu:

age --help

These commands let you encrypt and decrypt files using public keys, private keys, and passphrases. You can also choose where to save the output and work with multiple recipients.

End Note

Age is a useful command-line tool for protecting files and sensitive data in Termux. Its simple commands support public key encryption, passphrase protection, and file decryption. Keep your private keys and passphrases safe, as you need them to access your encrypted files.

SHARE THIS POST: