Phew, this was painful. Turns out most hints out there on how to use the
Boost serialization iterators are wrong. Here's why:
transform_width<6, 8>
needs an input stream of length: common multiple of 6 and 8.
That is, the padding needs to happen _before_ using the provided
iterators, otherwise the behavior is undefined!
See: http://www.boost.org/doc/libs/1_60_0/boost/archive/iterators/transform_width.hpp
Thanks @mokob for pointing that out to me!
We also need to manually add as many padding chars "=" to the encoded
result as many bytes we had to append to the input to conform to the
rule above.
Decoding then knows the number of padding chars by counting for "=" and
then using it in order to split off the last bytes from the decoded
result.