#!/bin/bash
filename="itworkmaybe.txt"
while read line; do
    openssl enc -aes-128-cbc -d -in ciphertext.txt -out itworkmaybe.txt -iv 0000000000000000 -K $line
    read aline < "$filename"
    if [ "$aline" == "This is a top secret." ]; then
        echo $line
        break
    fi
done < "$1"
