Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- [ -z "$1" ] && echo -e "USAGE:\n\t-e password passphrase\n\t-c" && exit 0
- secret="$HOME/.secret_vault"
- secret_p="$HOME/.secret_passphrase"
- if [ "$1" == "-e" ] && [ -n "$2" ] && [ -n "$3" ]; then
- touch $secret
- touch $secret_p
- echo "$2" | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:"$3" > "$secret"
- chmod 600 $secret
- echo "$3" > $secret_p
- chmod 600 $secret_p
- exit
- fi
- if [ "$1" == "-c" ]; then
- cat "$secret" | openssl enc -aes-256-cbc -md sha512 -a -d -pbkdf2 -iter 100000 -salt -pass pass:`cat "$secret_p"`
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement