Does trailing white space have to be deleted in textmode?
David Shaw
dshaw at jabberwocky.com
Tue Mar 30 15:04:43 CEST 2004
On Tue, Mar 30, 2004 at 12:06:18PM +0100, chris.1.sunderland at britishairways.com wrote:
>
> Hi,
>
> my users have a requirement to send 80 column fixed length records,
> encrypted using GPG, therefore the trailing white space should be kept on
> each line. However since they are sending files to various host system
> types, we also wish to use textmode, which seems to force the trailing
> white space to be stripped. Can this be prevented using GPG? We currently
> have installed GPG 1.2.2.
>
> I have read through various entries on the archive for this group, and I
> know as far as my testing goes, it can't be done. However, I am an amateur
> with GPG so I can't really be 100% percent sure of the answer. I have tried
> using the simple test mentioned in some entries thus:
>
> $ echo 'test ' | gpg -ear 78FD286F | gpg | tr ' ' 'x'
> gpg: encrypted with 2048-bit ELG-E key, ID 0FB754BF, created 2003-06-17
> "Chris Sunderland <chris.1.sunderland at britishairways.com>"
> testxxxx
>
> $ echo 'test ' | gpg -tear 78FD286F | gpg | tr ' ' 'x'
> gpg: encrypted with 2048-bit ELG-E key, ID 0FB754BF, created 2003-06-17
> "Chris Sunderland <chris.1.sunderland at britishairways.com>"
> test
>
> which shows the problem.
>
> Does anyone know if there is a solution? I have run the same tests using
> PGP, and it works as I would like it to - which one is correct?
GnuPG is correct in that it does what the standard requires, and
removes whitespace. PGP does what was historically correct, and does
not remove whitespace. There is good a bit of history behind the
whitespace trimming question, and in fact, it is being re-examined for
the upcoming update to the OpenPGP standard. Once the update is
published, both GnuPG and PGP should do this the same way, whichever
way this turns out to be.
In the meantime, unfortunately, there is no trivial way to get GnuPG
to trim as PGP does. You'll have to patch it, so I've attached a
patch.
I suppose I could just build this functionality into '--pgp8' or the
like, but the current schedule for the updated standard says it will
be ready in a few months, after which the whitespace trimming rule
will be clear.
David
-------------- next part --------------
Index: util/strgutil.c
===================================================================
RCS file: /cvs/gnupg/gnupg/util/strgutil.c,v
retrieving revision 1.37.2.2
diff -u -r1.37.2.2 strgutil.c
--- util/strgutil.c 30 Jul 2003 16:04:46 -0000 1.37.2.2
+++ util/strgutil.c 30 Mar 2004 12:44:18 -0000
@@ -316,7 +316,7 @@
unsigned
trim_trailing_ws( byte *line, unsigned len )
{
- return trim_trailing_chars( line, len, " \t\r\n" );
+ return trim_trailing_chars( line, len, "\r\n" );
}
unsigned int
More information about the Gnupg-users
mailing list