aboutsummaryrefslogtreecommitdiff
path: root/release/encrypt-secret.sh
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-07-01 14:29:30 +0530
committerGitHub <noreply@github.com>2020-07-01 14:29:30 +0530
commit83ba0a3ed56661c17b06b11fcb91c72b94f5974b (patch)
tree49711bc817827b9a15c5d46e0d6dc5531e231b98 /release/encrypt-secret.sh
parentf49d9c35e68faafe01f475f7a7525fbed31838db (diff)
Improve how secrets and stored and used (#907)
Diffstat (limited to 'release/encrypt-secret.sh')
-rwxr-xr-xrelease/encrypt-secret.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/release/encrypt-secret.sh b/release/encrypt-secret.sh
new file mode 100755
index 00000000..6d71c4bc
--- /dev/null
+++ b/release/encrypt-secret.sh
@@ -0,0 +1,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