[ietf-dkim] LWSP in base64-encoded public key TXT RR

Mark Martinec Mark.Martinec+dkim at ijs.si
Wed Mar 7 00:34:45 PST 2007


I came across a real life example where a public key as returned
by a DNS record contained embedded CR LF, probably due to a
misconfiguration or a broken DNS server implementation.

Two different DKIM implementations gave different treatment to the
situation, one claiming 'key syntax error', the other accepted it.

Turning to draft-ietf-dkim-base-10 reveals:

   key-p-tag    = %x70 [FWS] "=" [ [FWS] base64string ]
   base64string = 1*(ALPHA / DIGIT / "+" / "/" / LWSP)
                  [ "=" LWSP [ "=" LWSP ] ]
   LWSP =  *(WSP / CRLF WSP)

which would indicate that a public key in TXT RR
like the following would be alright:

  k=rsa; p=MIGfMA0GCSq<CR><LF><SP>GSIb3DQEBAQUA...

while the one without a <SP> would not be syntactically correct:

  k=rsa; p=MIGfMA0GCSq<CR><LF>GSIb3DQEBAQUA...

It seems the requirement to insist on LWSP (e.g. a WSP must follow CRLF)
in a non- message header context is very much artificial and unwarranted.

  Mark


More information about the ietf-dkim mailing list