12345678910111213141516171819202122232425262728293031323334353637 |
- #############################################################################
- #
- # PGP Functions
- #
- #############################################################################
- function pgp-encrypt()
- {
- tar -zcv $1 | gpg2 --encrypt -r ${2:-alex@matevi.sh} - > $1.tar.gz.gpg;
- }
- function pgp-decrypt()
- {
- gpg2 --decrypt $1 | tar -zxvf -;
- }
- function gpg-stash-mount()
- {
- (cd ~/.configs/gpg-stash && ./run.sh -d)
- }
- function gpg-stash-unmount()
- {
- (cd ~/.configs/gpg-stash && ./run.sh -r)
- }
- function switch-yubikeys()
- {
- # Running any decrypt, auth or sign will now ask you to insert Yubikey2
- # To switch to Yubikey1 at any time run this script to force GPG
- # to repoint the key stubs to the inserted Yubikey
- read -p "Insert the Yubikey you want to use .... " ignore
- echo "Switching GPG to backup Yubikey ..."
- gpg-connect-agent "scd serialno" "learn --force" /bye
- }
|