How to use the command 'rage' (with examples)
Rage is a simple, secure, and modern file encryption tool that allows users to encrypt and decrypt files with small explicit keys, no configuration options, and UNIX-style composability. It is a Rust implementation of the age
encryption tool.
Use case 1: Encrypt a file for user
and save it to message.age
Code:
echo "Your secret message" | rage --encrypt --recipient user --output path/to/message.age
Motivation:
You may want to encrypt a sensitive file so that only a specific user can decrypt it. By using the rage
command, you can easily encrypt the file and save it with the .age
extension, ensuring that it can only be decrypted by the intended recipient.
Explanation:
echo "Your secret message"
: This command outputs the content of the file you want to encrypt. Replace"Your secret message"
with the actual content of your file.rage --encrypt
: This flag tells therage
command to encrypt the input.--recipient user
: This option specifies the recipient of the encrypted file. Replaceuser
with the actual recipient’s name.--output path/to/message.age
: This option sets the output file path for the encrypted file. Replacepath/to/message.age
with the desired file path.
Example output:
The file containing the encrypted message will be saved as message.age
in the specified path.
Use case 2: Decrypt a file with identity_file
and save it to message
Code:
rage --decrypt --identity path/to/identity_file --output message
Motivation:
You may have received an encrypted file and need to decrypt it using your private key. By using the rage
command, you can easily decrypt the file and save it to a readable format.
Explanation:
rage --decrypt
: This flag tells therage
command to decrypt the input.--identity path/to/identity_file
: This option specifies the path to the identity file containing your private key. Replacepath/to/identity_file
with the actual file path.--output message
: This option sets the output file name for the decrypted file. Replacemessage
with the desired file name.
Example output:
The decrypted content of the file will be saved as message
in the current directory.
Conclusion:
The rage
command provides a simple and secure way to encrypt and decrypt files using small explicit keys. By following the examples provided, users can easily encrypt files for specific recipients and decrypt encrypted files using their private keys.