This documentation provides detailed instructions on how to use OpenSSL to encrypt and decrypt text files.
openssl enc -aes-256-cbc -salt -in path/to/your/file.txt -out path/to/your/file.encEnter a password when prompted. This password will be necessary to decrypt the file.
openssl enc -aes-256-cbc -d -in path/to/your/file.enc -out path/to/your/decrypted_file.txtEnter the password used for encryption when prompted.
OpenSSL is a suite of tools for communication security and cryptography, used for creating SSL/TLS certificates and for managing various cryptographic functions.
-
enc: This OpenSSL option indicates that you are using the encryption function. -
-aes-256-cbc: Specifies the encryption algorithm. AES (Advanced Encryption Standard) with a 256-bit key in CBC (Cipher Block Chaining) mode. -
-salt: Adds "salt" to the encryption key to improve security. The salt ensures that the keys generated are unique even if the same password is used multiple times. -
-in: Specifies the input file (the file you want to encrypt). -
-out: Specifies the output file (where you want the encrypted file to be saved). -
-d: Used during decryption. Indicates to OpenSSL to decrypt the data.
- These commands use the AES-256 algorithm to encrypt and decrypt the file.
- Do not forget the password used for encryption. Without it, you will not be able to access the contents of the encrypted file.
- Before encrypting important files, it is advisable to practice with test files to ensure you understand the process.