Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. for file in 'ls Testing'; do (echo <password>|gpg --passphrase-fd 0 -d $file
  2. --output $file.decrypted);
  3.  
  4. --passphrase-fd n
  5. Read the passphrase from file descriptor n. Only the first line will be read from file descriptor n. If you use 0 for n, the passphrase will be read from
  6. STDIN. This can only be used if only one passphrase is supplied. Note that this passphrase is only used if the option --batch has also been given. This is
  7. different from gpg.
  8.  
  9. --passphrase string
  10. Use string as the passphrase. This can only be used if only one passphrase is supplied. Obviously, this is of very questionable security on a multi-user sys‐
  11. tem. Don't use this option if you can avoid it. Note that this passphrase is only used if the option --batch has also been given. This is different from
  12. gpg.
  13.  
  14. echo "passphrase" | gpg --passphrase-fd 0 --batch -d --output "decrypted.file" "file.gpg"
  15.  
  16. gpg --passphrase "passphrase" --batch -d --output "decrypted.file" "file.gpg"
  17.  
  18. #!/bin/bash
  19.  
  20. read -rsp "Enter passphrase: " PASSPHRASE
  21.  
  22. for FILE in *.*.gpg; do
  23. echo "Extracting $FILE to ${FILE%.gpg}."
  24. echo "$PASSPHRASE" | gpg --passphrase-fd 0 --batch -d --output "${FILE%.gpg}" "$FILE"
  25. done
  26.  
  27. gpg --passphrase-fd 0 --decrypt-files *.gpg
  28.  
  29. gpg --decrypt-files *.gpg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement