Reputation: 22174
According to MIME base64 encoding specified in rfc2045, the base64 encoded data must be split in lines of at most 76 characters.
When decoding, all characters not belonging to the base64 alphabet must ne ignored.
How do we determine the end of MIME base64 encoded data ?
Upvotes: 1
Views: 590
Reputation:
When you've found the start of a base64 encoded object, it should always be possible to find the end without decoding it. Examples:
.
at the end of the SMTP DATA
.=?
first, then pass the encoded portion to the base64 decoder.Because the terminators are already identified before base64 decoding begins, the decoder never sees the terminator, so the rule "characters not belonging to the base64 alphabet" is not relevant.
The 2 steps of finding the end of the base64 data and decoding can be combined into a single loop over the input, for efficiency. But conceptually they are separate.
Upvotes: 1