Subject: Re: [xmpp] key+data object encryption (regarding draft-miller-3923bis-01)

From: "Ben Schumacher" <[email-masked]>
Date: Fri, 2 Apr 2010 10:07:43 -0700

On 3/31/10 8:47 AM, Matt Miller wrote:
>> You'll want to specify a fixed size for N, or including some sizing
>> information in the decoded bytes. You might also consider versioning in
>> your format for the decoded bytes to handle future adjustments to the
>> protocol. You could do this by adding a simple message header, with than
>> includes a single byte for version (apologies for my hackneyed ABNF):
>>
>> plaintext    = header-part / stanza-part
>>
>> header-part  = tag / version / stamp-part
>> tag          = "xmpp-objec"
>> version      = 2*HEXDIG           ; network byte order (NBO) version
>> stamp-part   = stamp-length / stamp-string
>> stamp-length = 4*HEXDIG           ; NBO length of stamp-string
>> stamp-string = *VCHAR             ; a known format is likely preferable
>> (ISO-8601),
>>                                     ; but knowing the length frees you
>> from making an
>>                                     ; assumption about precision
>>
>> stanza-part  = stanza / stanza-end
>> stanza       = *CHAR              ; UTF-8 encoded, naturally
>> stanza-end   = NUL
>>
>> This would all, of course, be encrypted. The ending NUL gives your XML
>> parser an easily identifiable ending point to the stanza, but you could
>> also include a length for the stanza in the format.
>>
>> Let me know if any of that doesn't make sense.
>>      
> I don't see a benefit of including versioning information here.  All of this is defined as the (encrypted and encoded) character content of a namespaced XML structure.  Wouldn't it be better to version this via the namespace instead?
>
>    
Matt-

The outside XML can be tampered with since there's no ability to verify 
it's integrity (HMAC's obviously difficult to apply to the work on the 
container stanza). Putting the version in the encrypted payload gives 
you an extra level of security to validate that what's on the container 
matches what's in the payload. Further, if you have some known "phrase" 
that the encrypted payload always begins with, you have a quick way to 
check and ensure that your decryption was successful before spinning up 
your XML parser.

You could always just put a plain text version of the namespace as the 
first N characters of the encrypted payload, but I think something 
that's more deterministic (a known length) would be desirable.

Cheers,
Ben