-
-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
age fails to decrypt files generated in Windows PowerShell #2
Comments
It looks like there are a couple bytes before the # in key.txt? Can you do a hexdump of the file? |
Looking at the hexdump, it seems to be creating 2 random characters at the start. Heres a gist of the hex dump: https://gist.github.com/BlackHoleFox/5dbfb60ba8d5180f2cbac53446597e4f |
Yeah, that's a BOM, and it looks like the text got also converted to UTF-16 (notice the zero bytes). That's not something we can support on the parsing side for sure, the file is effectively corrupt. Are we supposed to put stdout in some special mode to prevent this? I know next to nothing about PowerShell. |
So, replacing the By default, I get When I change the line endings of the files, I get |
The armored format ( |
When attempting a round trip on Windows using PowerShell, age errors out when trying to decrypt a file. I have confirmed the exact same steps work fine in WSL.
It creates the key file and the encrypted
.age
file properly as far as I can tell.Steps to reproduce:
./age -generate > key.txt
echo "Gophers" | ./age pubkey:h-yq6lhyIAdDc23LVXP_h1X5wpIgHvNk8kvbV0auhG4 > test.txt.age
/.age -d key.txt | Get-Content -raw test.txt.age
error: malformed secret keys file "key.txt": malformed secret key: ��# c r e a t e d : 2 0 1 9 - 1 0 - 0 7 T 0 0 : 0 5 : 3 7 - 0 5 : 0 0
key.txt contents (CRLF line endings):
The text was updated successfully, but these errors were encountered: