Android-Password-Store/release/encrypt-secret.sh
Harsh Shandilya ff3d2fcce3
release: script improvements (#915)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2020-07-03 07:03:17 +02:00

15 lines
501 B
Bash
Executable file

#!/usr/bin/env bash
set -ex
# Simple script that uses OpenSSL to encrypt a provided file with a provided key, and writes the result
# to the provided path. Yes it's very needy.
INPUT_FILE=$1
OUTPUT_FILE=$2
ENCRYPT_KEY=$3
if [[ -n "$ENCRYPT_KEY" && -n "$INPUT_FILE" && -n "$OUTPUT_FILE" ]]; then
openssl enc -aes-256-cbc -md sha256 -pbkdf2 -e -in "${INPUT_FILE}" -out "${OUTPUT_FILE}" -k "${ENCRYPT_KEY}"
else
echo "Usage: ./encrypt-secret.sh <input file> <output file> <encryption key>"
fi