tag:gpgtools.tenderapp.com,2011-11-04:/discussions/problems/77260-how-can-i-use-gpgtools-to-decrypt-and-ascii-armored-fileGPGTools: Discussion 2019-07-01T09:40:39Ztag:gpgtools.tenderapp.com,2011-11-04:Comment/457604852018-07-24T05:12:29Z2018-08-09T09:33:16ZHow can I use gpgtools to decrypt and ascii armored file? (gpg: decryption failed: Bad session key)<div><p>I have migrated from another OS to MACOS. I have a number of *.asc files that use text passphrase. For EXAMPLE, that would be a file created with gpg -c -a FILENAME and as an example, passphrase gpgtools123. If I create this on my Mac it works and gpg -d works just fine.</p>
<p>But when I try this for a migrated file from another OS (encrypted using gpg 2.2.5) I get<br>
gpg -d "FILE NAME.asc"<br>
gpg: CAST5 encrypted data<br>
gpg: encrypted with 1 passphrase<br>
gpg: decryption failed: Bad session key</p>
<p>The suggestion of "defaults write ~/Library/Preferences/org.gpgtools.gpgservices UseASCIIOutput -bool YES" did not help, the output of the command was the same as above.</p>
<p><strong>What did you expect instead</strong></p>
<p>I expected it to decrypt the file.</p>
<p><strong>Describe steps leading to the problem.</strong> see above</p>
<p><strong>Are you using any other Mail.app plugins?</strong> no, I'm using CLI attempting decrypt *asc file</p></div>jfharrisontag:gpgtools.tenderapp.com,2011-11-04:Comment/457604852018-08-09T08:48:33Z2018-08-09T08:48:33ZHow can I use gpgtools to decrypt and ascii armored file? (gpg: decryption failed: Bad session key)<div><p>Hi!</p>
<p>Could you please create two encrypted files for us?<br>
Both with the same (non private) content and the password gpgtools123.<br>
One decryptable on your Mac, the other one should not be decryptable on your Mac.</p>
<p>Do you have any special characters in the password?<br>
Do you have a very long password (over 80 characters)?</p>
<p>You could try to use a password file instead of pinentry:<br>
1. Create a file pass.txt which contains only your password.<br>
2. Decrypt using this password file:<br></p>
<pre>
<code>gpg -d --pinentry-mode loopback --passphrase-file pass.txt < encrypted.asc</code>
</pre>
3. Delete the password file:<br>
<pre>
<code>rm pass.txt</code>
</pre>
<p>Regards, Mento</p></div>Mentotag:gpgtools.tenderapp.com,2011-11-04:Comment/457604852018-08-10T19:32:30Z2018-08-10T19:32:30ZHow can I use gpgtools to decrypt and ascii armored file? (gpg: decryption failed: Bad session key)<div><p>Thank you. Only the --pinentry-mode worked, after a failure due to requiring me to add --ignore-mdc-error. Below is my screen output:</p>
<p>$ gpg -d --pinentry-mode loopback --passphrase-file pass.txt < "Credit Reports.zip.asc" > CR.zip gpg: CAST5 encrypted data<br>
gpg: encrypted with 1 passphrase<br>
gpg: WARNING: message was not integrity protected<br>
gpg: Hint: If this message was created before the year 2003 it is<br>
likely that this message is legitimate. This is because back then integrity protection was not widely used. gpg: Use the option '--ignore-mdc-error' to decrypt anyway.<br>
gpg: decryption forced to fail!</p>
<p>$ gpg -d --ignore-mdc-error --pinentry-mode loopback --passphrase-file pass.txt < "Credit Reports.zip.asc" > CR.zip gpg: CAST5 encrypted data<br>
gpg: encrypted with 1 passphrase<br>
gpg: WARNING: message was not integrity protected<br>
$</p></div>jfharrisontag:gpgtools.tenderapp.com,2011-11-04:Comment/457604852018-10-27T17:19:32Z2018-10-27T17:19:32ZHow can I use gpgtools to decrypt and ascii armored file? (gpg: decryption failed: Bad session key)<div><p>Hi JF,</p>
<p>in order to have gpg accept any passphrase options you have to add --batch</p></div>Luke Le