if (( layer == 0 || layer > num_layers ));then
cat
else
- openssl enc $openssl_decrypt "-$(sed -n "${layer}s/ .*//p" "$keyfile")" \
- -pass fd:37 37< <(sed -n "${layer}s/^[^ ]* //p" "$keyfile") |
- go $(( layer + next_layer ))
+ operation=$(sed -n "${layer}s/ .*//p" "$keyfile")
+ if [[ "$operation" == openssl-enc ]];then
+ openssl enc $openssl_decrypt "-$(sed -rn "${layer}s/[^ ]+ ([^ ]+) .*/\\1/p" "$keyfile")" \
+ -pass fd:37 37< <(sed -rn "${layer}s/^[^ ]+ [^ ]+ //p" "$keyfile")
+ else
+ die "Unknown operation"
+ fi |
+ go $(( layer + next_layer ))
fi
}
i=0
while read -r cipher;do
echo -n $'\r'"Generating key $((++i))/${#ciphers[*]}" >&2
- cat >> "$keyfile" <<< "$cipher $(head -c 99 "$random_source" | base64 --wrap=0 )"
+ cat >> "$keyfile" <<< "openssl-enc $cipher $(head -c 99 "$random_source" | base64 --wrap=0 )"
done < <( IFS=$'\n'; shuf <<< "${ciphers[*]}"; )
echo >&2