gpg 1.4.9 (Unix) textmode file size limit

David Shaw dshaw at jabberwocky.com
Fri Dec 5 22:38:13 CET 2008


On Fri, Dec 05, 2008 at 10:11:58AM -0600, Seidl, Scott wrote:

> I ran into an issue today when trying to encrypt a large file (18
> MB) with the --textmode option.  We received the following error
> message from GNUPG: gpg: can't handle text lines longer than 19995
> characters.  Can someone explain more about this error and if there
> are any other limits I need to know about?
> 
> I understand the cause of this error (18MB file without any CR/LFs),
> and that we really shouldn't use it.  I just want to understand more
> about this limit in case I ever encounter a need to have large
> records and the - -textmode option.

--textmode turns on the RFC-4880 text processing which canonicalizes
line endings.  When it is enabled, all local line endings are
converted to CRLF pairs when encrypting, and similarly converted from
CRLF to local when decrypting.  Note that "local" is different
depending on what your local platform is.  Unix-ish machines tend to
use LF as their line ending.  Windows uses CRLF.  Other platforms may
use a bare CR, or a null or whatever they like.

So, let's say that you have a Unix-ish text file (so LF line endings).
You encrypt it using --textmode, so the encrypted file contains CRLF.
You then decrypt it using --textmode on a Unix box, so the line
endings are transformed back to LF.  If you had decrypted it on a
Windows box, the line endings would be CRLF.  An obvious side effect
of --textmode is that you may not get out exactly what the sender put
in (as the line endings may have been changed).

Aside from the 19995 characters per line limit, there aren't any other
limitations you need to know about.  In general, unless you're moving
text files, you don't need --textmode.

David



More information about the Gnupg-users mailing list