chore(crypt): switch to use openssl
This commit is contained in:
parent
804780df8b
commit
a3158b5c51
3 changed files with 6 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Cache functions
|
||||
get_filecache() {
|
||||
echo "$cachepath/$(filehash).tar.gpg"
|
||||
echo "$cachepath/$(filehash)$ZPASS_EXTENSION"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ cachepath=${ZPASS_CACHE_PATH-$cachepath}
|
|||
|
||||
# default ZPASS
|
||||
ZPASS_FILE=${ZPASS_FILE-default}
|
||||
ZPASS_EXTENSION=${ZPASS_EXTENSION-.tar.gpg}
|
||||
ZPASS_EXTENSION=${ZPASS_EXTENSION-.tgz.enc}
|
||||
ZPASS_KEY_CACHE_TIME=${ZPASS_KEY_CACHE_TIME-60}
|
||||
ZPASS_CLIPBOARD_TIME=${ZPASS_CLIPBOARD_TIME-30}
|
||||
ZPASS_UNK_OP_CALL=${ZPASS_UNK_OP_CALL-copy}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
# $1 = key
|
||||
encrypt() {
|
||||
gpg --pinentry-mode loopback --batch --passphrase "$1" -o - -c -
|
||||
gzip | openssl enc -aes-256-cbc -pbkdf2 -salt -in - -out - -k "$1"
|
||||
}
|
||||
|
||||
# $1 = key , $2 = keyfile to write
|
||||
decrypt_with_key()
|
||||
{
|
||||
gpg --pinentry-mode loopback --batch --passphrase "$1" -o - -d "$file" 2>/dev/null || return $?
|
||||
{
|
||||
openssl enc -d -aes-256-cbc -pbkdf2 -in "$file" -out - -k "$1" || return $?
|
||||
} | gzip -d
|
||||
[ -n "$2" ] && echo "$1" > "$2"
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue