My requirement is to encrypt/decrypt a tcl file without a openssl password prompt, but read the password automatically from a file. my test_en.tcl has the following encrypt/decrypt commands:

exec openssl enc -aes-256-cbc -in  test_en.tcl -out encrpt_test_en.tcl
exec openssl enc -aes-256-cbc -d -in encrpt_test_en.tcl > new_test_en.tcl

How can I read the password from a file into tcl script and avoid manual entry to encrypt/decrypt the file automatically?

Please suggest correct way to send the password to tcl script.


From man openssl , you can see that enc have the option -kfile .

   -kfile file
             Read the password to derive the key from the first line of file.  Superseded by the -pass option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.