feat: "manual encryption of flows_cred.json" #9

Merged
jon_nfc merged 6 commits from 4-flow-cred into development 2023-08-15 07:32:46 +00:00
2 changed files with 34 additions and 1 deletions
Showing only changes of commit d001f36c6b - Show all commits

29
encrypt-flows-cred.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
#
# Description:
# Encrypt flows_cred.json.tmp from the specified directory to flows_cred.json. You will be prompted for the encryption password.
#
# Usage:
# ./encrypt-flows-cred.sh {path to cred file, if PWD use '.'}
#
# Changelog:
# 2023-08-15: Script creation.
#
echo -n "Please enter the flows_cred.json decryption key: ";
read -s PASSWORD;
echo;
Rand=$(tr -dc 'A-Fa-f0-9' </dev/urandom | head -c 32);
EncryptedData=$(cat $1/flows_cred.json.tmp | openssl enc -aes-256-ctr -e -a -A -iv $Rand -K `echo -n $PASSWORD | sha256sum | cut -c 1-64`)
cat <<EOF > $1/flows_cred.json
{
"$": "$Rand$EncryptedData"
}
EOF
echo;
rm $1/flows_cred.json.tmp;