How to encrypt a file?

To encrypt a file using OpenSSL, you can use the following command:

openssl enc -aes-256-cbc -salt -in filename.txt -out filename.enc -pbkdf2

Breakdown of the command:

  • openssl enc: Invokes the OpenSSL command for encryption.
  • -aes-256-cbc: Specifies the AES encryption algorithm with a 256-bit key in CBC mode.
  • -salt: Adds a random salt to the encryption process for enhanced security.
  • -in filename.txt: Indicates the input file you want to encrypt (replace filename.txt with your actual file name).
  • -out filename.enc: Specifies the output file for the encrypted data (replace filename.enc with your desired output file name).
  • -pbkdf2: Uses the PBKDF2 key derivation function for better security when generating the encryption key from a password.

Steps to Encrypt a File:

  1. Open your terminal.
  2. Run the command above, replacing filename.txt and filename.enc with your actual file names.
  3. You will be prompted to enter a password. Choose a strong password for encryption.
  4. After entering the password, the file will be encrypted, and the output file will be created.

If you have any further questions or need assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!