decrypt adding ^M characters at the end of each line

David Shaw dshaw at jabberwocky.com
Tue Aug 2 17:43:30 CEST 2011


On Aug 2, 2011, at 9:55 AM, Randy Braun wrote:

> 
> Anyone have any ideas as to why I am seeing ^M characters at the end of
> each line after decrypting a file?
> 
> I am using the following:
> 
> /sftw/gnupg/bin/gpg --output /path/path/testfile.txt
> --decrypt /path/path/testfile.txt.pgp
> 
> This is gnupg 1.4.10 on AIX 5.3.12.2

This sort of thing can happen when the sender and receiver machines have different conventions for what ends a line of text.  Unix machines use LF, Windows uses CRLF, etc.  GPG has built-in support for handling this confusion, but you have to tell it that the input file is text.

So, on the *encrypting* side, add "--textmode" to the command, and that will tell GPG to store things appropriately, and the decrypting side will recognize this and use the appropriate line endings in the resulting file.

David




More information about the Gnupg-users mailing list