-pass file:nameofkeyfile to the OpenSSL command line. This causes OpenSSL to read the password/passphrase from the named file, but otherwise proceed normally.
For more details, see the man page for openssl(1) (
man 1 openssl) and particularly its section "PASS PHRASE ARGUMENTS", and the man page for enc(1) (
man 1 enc).
If the key file actually holds the encryption key (not something from which to derive the encryption key), then you want to use
-K instead. For that, you need something like:
-K $(hexdump -v -e '/1 "%02X"' < nameofkeyfile)
in the OpenSSL command line instead of
hexdump is used to transform the key file to the pure hexadecimal representation that OpenSSL wants.