Skip to content
Permalink
Browse files

initial push

  • Loading branch information...
eddinn committed Oct 7, 2019
1 parent b59f1a4 commit 94d6ca49eddbe3e88b415a5ae1421ea3b8b75024
Showing with 34 additions and 0 deletions.
  1. +17 −0 filecrypt
  2. +17 −0 filecrypt.sh
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# get filename from the first appended script variable
FILE=$1

# check file extension for decryption, else create file for encryption
if [ "${FILE: -4}" == ".enc" ]
then
openssl enc -aes-256-cbc -pbkdf2 -d -a -in "$FILE" -out tmpfile.txt || exit 1
vim tmpfile.txt
openssl enc -aes-256-cbc -pbkdf2 -a -in tmpfile.txt -out "$FILE" || exit 1
rm -Rf tmpfile.txt
else
vim "$FILE"
openssl enc -aes-256-cbc -pbkdf2 -a -in "$FILE" -out "$FILE".enc || exit 1
rm -Rf "$FILE"
fi
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# get filename from the first appended script variable
FILE=$1

# check file extension for decryption, else create file for encryption
if [ "${FILE: -4}" == ".enc" ]
then
openssl enc -aes-256-cbc -pbkdf2 -d -a -in "$FILE" -out tmpfile.txt || exit 1
vim tmpfile.txt
openssl enc -aes-256-cbc -pbkdf2 -a -in tmpfile.txt -out "$FILE" || exit 1
rm -Rf tmpfile.txt
else
vim "$FILE"
openssl enc -aes-256-cbc -pbkdf2 -a -in "$FILE" -out "$FILE".enc || exit 1
rm -Rf "$FILE"
fi

0 comments on commit 94d6ca4

Please sign in to comment.
You can’t perform that action at this time.