blob: 6d71c4bc4ab11b915bb1d93be6682bcf6e7925ae (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/usr/bin/env bash
# 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
|