Subject: RE: Dash-escaping clarification

From: "Dominikus Scherkl" <[email-masked]>
Date: Mon, 10 Mar 2003 11:51:43 +0100

> I don't see how there would be a problem in reversing the
> transformation.
> 
> - bullet point
> becomes
> - - bullet point
> and reverses back to
> - bullet point
> 
> random text
> becomes
> - random text
> and reverses back to
> random text

MAY means: arbitrary lines may get a dash-escape, others do not.
so how do you manage to recognise which leading "- " were there
before encoding and which were not, without looking at the
following text?
Now this is easy: a sequence "- -" becomes "-" and "- From" becomes
"From", anything else is left unchanged.
But if any other lines MAY be escaped, looking at the context
doesn't help any more. Dashes are used also to mark insertions
- at least in german this is common - and how can a parser find
out if the "- " in the above line is intentional? or that in the next?
- From all solutions I prefer not to allow escaping other then
those starting with "-" or "From" - it simply works, and I think
your solution won't. Maybe it will take a while, but one day
we may worry about another head-aching problem introduced in the
long ago 2003-version of pgp, and can't help it in other ways
as to once again restrict it to all the odd cases which become
relevant or change the MAY to a MUST - ending up with CRLF beeing
extendet to "CRLF- ".

-- 
Dominikus Scherkl
[email-masked]

---

From: Werner Koch <[email-masked]>
Date: Mon, 10 Mar 2003 13:38:56 +0100

> out if the "- " in the above line is intentional? or that in the next?

It does not need to.  There are 2 ways to convert dash escaped text:

 1. Look for a line starting with a dash and check whether the next
    character is a space.  If it is not a space bail out with an
    error: "not an OpenPGP conform message"

 2. Look for a line starting with a dash and a space (or end-of-line)
    and remove it; copy verbatim in all other cases.

Of course, this should only be done while in a -----BEGIN/END section.

The second approach is the simplest and what most applications do.

> those starting with "-" or "From" - it simply works, and I think

This requires extra logic and a 6 byte look-ahead (" From ") and you
gain nothing by it.  With the straighforward approach you can simple
sed the dash escaped text.

KISS.

Shalom-Salam,

   Werner

---

From: David Shaw <[email-masked]>
Date: Mon, 10 Mar 2003 08:39:13 -0500

> before encoding and which were not, without looking at the

This is not correct.  The MAY is for additional lines, after the
regular "-" encoding is done.

To be clear, the current rule is:
   1) Escape any lines beginning with '-'.

There is also an undocumented rule #2:
   2) Escape any lines beginning with "From".

The proposed change is:

   1) Escape any lines beginning with "-".
   2) Escape any other lines you want.

The only change is in #2.

David

---

From: "Jeroen C. van Gelderen" <[email-masked]>
Date: Mon, 10 Mar 2003 11:14:55 -0500

> before encoding and which were not, without looking at the

The spec also states that all lines starting with "-" are escaped 
unconditionally. Which means that any armored line starting with a "- " 
is an escaped line because it cannot be a non-escaped line. And thus 
can be stripped off its "- " prefix without looking at the following 
text.

> - From all solutions I prefer not to allow escaping other then

It doesn't have to. Your example will always be translated to:

- - at least in german this is common - and how can a parser find
out if the "- " in the above line is intentional? or that in the next?
- - From all solutions I prefer not to allow escaping other then

and thus can be unescaped unambiguously.

Allowing every line to be escaped yields a simpler unescaping 
algorithm. Simplicity is a selling point when security is concerned. It 
is also compatible with PGP behaviour dating back to God knows when and 
thus will not cause any problems that are not already apparent in PGP.

Cheers,
-J