summaryrefslogtreecommitdiff
path: root/scripts/encrypt-secret.sh
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-10-16 20:48:11 +0530
committerGitHub <noreply@github.com>2020-10-16 17:18:11 +0200
commit6c1e41ba1050c92f4b615f7e857e0d085120a242 (patch)
tree5be0bc1e6c1a2afeda9ba9566c12a791302b7918 /scripts/encrypt-secret.sh
parent92f1aab25da12411aa256c3b763e0cb6182e9320 (diff)
Revamp build configuration (#1156)
* release: move scripts to scripts directory Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Move CI secrets to secrets directory Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * gradle: uprev to 6.7 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * gradle: suppress warnings about unsupported options Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * build: update dependencies Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * build: move Gradle plugins to ext Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * build: move configuration tasks to buildSrc Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * CHANGELOG: add entry for #1137 Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Fix lint warnings Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'scripts/encrypt-secret.sh')
-rwxr-xr-xscripts/encrypt-secret.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/encrypt-secret.sh b/scripts/encrypt-secret.sh
new file mode 100755
index 00000000..7c762d19
--- /dev/null
+++ b/scripts/encrypt-secret.sh
@@ -0,0 +1,15 @@
+#!/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