I'm writing a Powershell script to create backup archives and encrypt them. I selected GPG4Win to do the encryption. I do:
gpg --batch --passphrase-file $KeyFile --symmetric $File
And this works, I get an encrypted .gpg file, but when I decrypt it:
gpg --batch --passhprase-file $KeyFile -d $File > $DecryptedFile
I get a file that is different from the original. For text files the example can be seen in the screenshot of HEX viewers. The lower one is the original text file and the above one has been encrypted and then decrypted. Note the extra FF FE and 00 bytes.
I think that ANSI files becomes UNICODE one.
This isn't such an issue for text files, but I cannot open decrypted binary files.
The same issue happens no matter if I run commands interactively from Powershell, or via script. I didn't have this issue on Linux and I don't know what I'm doing wrong here. The OS is Win10 Pro if it makes any difference.