質問

So the larger context of this problem is that it isn't possible, for whatever reason, to decrypt this file using, say, Bouncy Castle, so we're trying to do an automated command line with the normal gpg utility instead... I originally thought that would be quicker than trying to figure out why Bouncy Castle doesn't believe this is a real PGP-encrypted file, but I might have been wrong.

Here's the pipeline:

echo password | gpg --batch --yes --passphrase-fd 0 "filename"

This works perfectly in Powershell. Actually, several variations on this work perfectly in Powershell, but that's not the point...

The point is that I'm trying to run this in cmd.exe and it doesn't work there. Instead, I get an error saying that there has been no password provided and that, therefore, there is no secret key available and that, therefore, the file cannot be decrypted.

Given that the instructions I read for this are specifically for cmd.exe (not Powershell), I'm more than a little confused. Any idea what's going on here?

役に立ちましたか?

解決

Apparently, the problem is that the password being passed through the pipeline includes a space--the one that appears between our hypothetical "d" and the pipe symbol itself. :)

So, for future reference, this works:

echo password|gpg --batch --yes --passphrase-fd 0 "filename"

Which, by the way, is exactly what the guide had said, but which I never caught onto because I did my initial testing in Powershell and didn't realize how picky cmd's echo command could be.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top