Simplification by reusing encoding protocols

Date: 2011-02-04 07:01 pm (UTC)
The CAKE protocol looks interesting but it mixes two concepts: structured data encoding, and security encapsulation of message passing.

IMHO, if you were enforcing and reusing off the shelf encoding like thrift or protobuf, it would make the design and code much simpler to parse.

The following will probably look naive as I haven't looked at CAKE implementation code, maybe I haven't scoped the whole problem.

Once you've done that, it would be merely:
raw_data = pipe.read()
# unpack_header is a thrift/protobuf raw reader.
hdr = unpack_header(raw_data)

# hdr.firsthmac and hdr.messages are still encrypted at this point
# hdr.messages is a list of message as defined at http://www.cakem.net/v2/sessions.html#repeated

# Grab valid key, verify signature. Throws on invalid signature, etc.
process(hdr)

# hdr.firsthmac is now decrypted and verified

if hdr.message_type == 1:  # session continuation
  for message in hdr.messages:
    # unpack_data is whatever decoding the user wants to use.
    # in practice, it's probably better to not even have this function here and
    # just yield the raw buffer.
    data = unpack_data(decrypt_and_verify(hdr.key, message.padding))
    yield data

Both thrift and protobuf handle a lots of the problems for you like: futureproofing the protocol message format, efficient encoding & decoding of native types line int&string, multi-language support, golden message definition in a single file, etc.
(will be screened)
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

Lover of ideas

February 2017

S M T W T F S
   1234
567891011
121314151617 18
19202122232425
262728    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 25th, 2025 03:50 am
Powered by Dreamwidth Studios