GPG 2 decrypt from STDIN via pasting inconsistency

1

1

Does anyone know why in some cases you can do this:

gpg2 -d

And paste your GPG message into the terminal, type ctrl+D, get prompted for your passphrase and get the results to STDOUT? But in other cases, when you paste the message after running the above command, the passphrase entry prompt comes up immediately with a partially filled in password (which will be wrong so you hit enter and re-enter the correct passphrase). After this, you can type ctrl +D and it will decrypt the message?

jshort

Posted 2015-03-04T05:47:38.103

Reputation: 111

Answers

0

One reason might be that the contents contain the ASCII character 4, which is equivalent to ctrl-d ("EOT end of transmission"); followed by any additional input: this is the same as you pasting the encrypted data, pressing ctrl-d and typing some final garbage.

You could use a hex editor to analyze the input. If you find a character (byte) 04, then you spotted the problem.

Jens Erat

Posted 2015-03-04T05:47:38.103

Reputation: 14 141

Good thought but on at least one of them that is not the case, no hex 04 in the message. – jshort – 2015-03-05T04:16:43.720