Florian Weimer writes:
Actually, the RFC *requires* skipping non-base64 characters.
That requirement is considerably modified by the sentence after it:
All line breaks or other characters not
found in Table 1 must be ignored by decoding software. In base64
data, characters other than those in Table 1, line breaks, and other
white space probably indicate a transmission error, about which a
warning message or even a message rejection might be appropriate
under some circumstances.
My code first tries to find the end of the base64 data (as intended by
the sender, I mean). Only after finding an end does it call the base64
decoder. It wasn't too difficult to write.