user3437245
user3437245

Reputation: 347

command substitution in openssl

Trying to run this in ksh:

echo -n "string to encode" |
openssl enc -aes-128-cbc -a -salt -pass file:<(print -n 'somepassword')

keep getting error:

unknown option '/dev/fd/10'

what can I be doing wrong, I have searched but no answer.

Upvotes: 0

Views: 451

Answers (1)

that other guy
that other guy

Reputation: 123640

Process substitution works differently in bash and ksh. Bash appends the result to the current word, ksh creates a new word:

$ cat testcase
showargs() { printf 'Arg: %q\n' "$@"; }
showargs file:<(echo -n foo)

$ bash testcase
Arg: file:/dev/fd/63

$ ksh testcase
Arg: file:
Arg: /dev/fd/3

I don't know whether ksh supports constructing arguments on the form that openssl requires it to be, so either use one of the other password passing mechanisms, use a temp file, manually open your own fd, or switch shell.

PS: -d means "decrypt".

Upvotes: 2

Related Questions