FILE_TO_DECRYPT="file.txt._Futurecrypt-Fri-Jan-13-0900-UTC-2012_.gpg" # Step 1: Determine the Key ID of the Key used to encrypt the file: # (attempt to decrypt file without key: gpg --keyid-format long --decrypt "$FILE_TO_DECRYPT") FC_KEYID=$(gpg --keyid-format long --decrypt "$FILE_TO_DECRYPT" 2>&1 | grep -o "[A-F0-9]\{16\}") # Step 2 (Optional): Get the Decryption date and time FC_DATEFILE="$FC_KEYID"_decryption_date.txt wget "https://www.futurecrypt.com/cryptokey/$FC_KEYID/$FC_DATEFILE" #curl -o "$FC_DATEFILE" "https://www.futurecrypt.com/cryptokey/$FC_KEYID/$FC_DATEFILE" FC_KEYDATE=$(cat $FC_DATEFILE) echo "Local decryption date and time:" $(date --d @"$FC_KEYDATE") echo "UTC decryption date and time:" $(date -u -d @"$FC_KEYDATE") # Step 3: Get the Decryption Key (Private Key) # This will only work after the decryption date and time! # This will only work for keys that have not been revoked! # Please do not attempt to download keys faster than 1/second - # Our denial-of-service protection may temporarily block your IP address. FC_KEYFILE="$FC_KEYID"_private.asc sleep 1 wget "https://www.futurecrypt.com/cryptokey/$FC_KEYID/$FC_KEYFILE" #curl -o "$FC_KEYFILE" "https://www.futurecrypt.com/cryptokey/$FC_KEYID/$FC_KEYFILE" gpg --import "$FC_KEYFILE" # Step 4: Decrypt the file DECRYPTED_FILE=$(echo "$FILE_TO_DECRYPT" | sed "s/._Futurecrypt.*//") echo "Decrypted file:" $DECRYPTED_FILE gpg --yes --output "$DECRYPTED_FILE" --decrypt "$FILE_TO_DECRYPT"