c0defellas / enzo

core utilities
11 stars 2 forks source link

cipher: proper cipher/decipher tool #35

Open katcipis opened 7 years ago

katcipis commented 7 years ago

I was already sad with my gpg that for only ciphering with a symmetric key asks for the password on a GUI. Lately I wanted to write some automation and this was getting on my way, trying to get around it I found this:

http://stackoverflow.com/questions/17769831/how-to-make-gpg-prompt-for-passphrase-on-cli

Requiring an agent just to know how you are going to receive a password does not seem to be simple...neither safe. The objective here is just to create a VERY simple tool that ciphers data symmetrically, it will guarantee confidentiality only, no guarantees on identity or integrity of data (would require key pairs). These other two problems could be addressed later if needed, I don't use them right now :-)

lborguetti commented 7 years ago

Ok, but that code bellow help to resolve your question ;)

#!/bin/bash

read -rsp "Enter passphrase: " PASSPHRASE

for FILE in *.*.gpg; do
    echo "Extracting $FILE to ${FILE%.gpg}."
    echo "$PASSPHRASE" | gpg --passphrase-fd 0 --batch -d --output "${FILE%.gpg}" "$FILE"
done
katcipis commented 7 years ago

@lborguetti the code bellow is mentioned on stack overflow, for me it does not solve it, it is still cumbersome. Does not make sense to me to require a agent to work with symmetrical cryptography.

i4ki commented 7 years ago

another problem with the solution is that your password is visible for every other program running on the machine by listing processes (ps aux)....