Shouldn't the input be wrapped in a base 64 input stream as well?