How to encrypt a file with a password using OpenSSL
Reference of commands to encrypt a file with a password using OpenSSL.
Update 5 Aug 2020: with recent versions of openssl the -pbkdf2
flag should be used for secure password hashing. Omit this flag if using an earlier version of openssl that doesn’t support it, or even better upgrade to a version that supports it!
Encryption
To encrypt a file:
|
|
You will be prompted to enter an encryption password. If you want to specify the password in the command use the -pass
parameter, for example to encrypt with the password myPassword
run:
|
|
To list the available encryption algorithms run:
|
|
Decryption
To decrypt a file:
|
|
You will be prompted to enter the decryption password.
To specify the password in the command use the -pass
parameter. For example to decrypt using the password myPassword
run:
|
|