[usmt dev]Encoding binary data in headers?
Mike Schiraldi
dev@smime.pyerotechnics.com
Mon, 12 Feb 2001 11:30:13 -0500 (EST)
I'd like to hear some comments on the best way to encode binary data in
our RFC822-lookalike format.
Here are two options i'm considering:
Option 1: Encode any taboo character with its backslash-octal equivalent
(i.e. Ctrl-A would be \001). Backslash itself would be a taboo character,
of course.
Foo: Blah
Bar: \008\004\007\177\122q\114\015%\120\065
Option 2: If a field contains any taboo characters or begins with a colon,
base64 the field and prepend a colon.
Foo: Blah
Bar: :SWYgeW91IGRlY29kZWQgdGhpcywgeW91IGFyZSBhIG5lcmQu
I think i prefer Option 2, since it's easier to fold and you know right
away whether a field contains anything weird. But Option 1 may be more
readable for a field that just contains one or two taboo characters.