aboutsummaryrefslogtreecommitdiff
path: root/scripts/encrypt_file.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/encrypt_file.sh')
-rwxr-xr-xscripts/encrypt_file.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/encrypt_file.sh b/scripts/encrypt_file.sh
new file mode 100755
index 0000000..cee8c86
--- /dev/null
+++ b/scripts/encrypt_file.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+F="$(readlink -f "$1")"
+
+cd "$(dirname "$0")/.."
+
+TMP="$(mktemp)"
+KEY="$(gpg2 --decrypt files/keys/primary.gpg)"
+
+PASS_ENC="$KEY" openssl aes-192-cbc -e -a -pass env:PASS_ENC -in "$F" -out "$TMP"
+mv "$TMP" "$F"