From 2d86304f3aa1f41b1b89dab9afd5f2a5944fcbae Mon Sep 17 00:00:00 2001 From: s2 Date: Fri, 27 Oct 2017 16:12:58 +0200 Subject: [PATCH] wait for plaintext to be available before outputting cypher --- sshencdec.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sshencdec.sh b/sshencdec.sh index 18ce979..c021f15 100755 --- a/sshencdec.sh +++ b/sshencdec.sh @@ -49,6 +49,8 @@ trap cleanup EXIT if [[ "${#public_key[@]}" > 0 ]]; then openssl rand 32 > $temp_file_key + plaintext=`cat` + echo "-- encrypted with https://git.e.tern.al/s2/sshencdec" echo "-- keys" for pubkey in "${public_key[@]}" @@ -65,7 +67,7 @@ if [[ "${#public_key[@]}" > 0 ]]; then done echo "-- /keys" - if openssl enc -aes-256-cbc -salt -pass file:"$temp_file_key" > "$temp_file"; then + if echo "$plaintext" | openssl enc -aes-256-cbc -salt -pass file:"$temp_file_key" > "$temp_file"; then openssl base64 < "$temp_file" fi