I am trying to crypt and decrypt Strings. Now I have done this:
mis@fasan:~$ echo "hallo" | gpg --symmetric --pgp8 --cipher-algo AES256 > /tmp/1
Enter passphrase:
Repeat passphrase:
mis@fasan:~$
mis@fasan:~$ cat /tmp/1 | gpg --decrypt
gpg: AES256 encrypted data
Enter passphrase:
gpg: encrypted with 1 passphrase
hallo
mis@fasan:~$
It works just like I want it to work. Now I have tried it with a passphrase out of a file, but it didn't work:
mis@fasan:~$ echo "hallo" | gpg --symmetric --pgp8 --cipher-algo AES256 --passphrase-fd 0 < /home/mis/testgpg > /tmp/1
Reading passphrase from file descriptor 0
mis@fasan:~$
mis@fasan:~$ cat /tmp/1 | gpg --decrypt
gpg: AES256 encrypted data
gpg: encrypted with 1 passphrase
It is very interesting, that he asks for the passphrase. If I write a wrong one, I get an error message, but if I write the right passphrase, I do not get my cryptet String. My target is to reach this:
mis@fasan:~$ echo "hallo" | gpg --symmetric --pgp8 --cipher-algo AES256 --passphrase-fd 0 < /home/mis/testgpg > /tmp/1
Reading passphrase from file descriptor 0
mis@fasan:~$
mis@fasan:~$ cat /tmp/1 | gpg --decrypt --passphrase-fd 0 < /home/mis/testgpg
Reading passphrase from file descriptor 0
gpg: decrypt_message failed: eof
mis@fasan:~$
But this doesn't work either. Does anyone know, what I am doing wrong?