The code would probably benefit from a helper function for the base64 decoding, instead of having a nested do-while loop. Also, it's pointless to have an else-block if you unconditionally break / return in the preceding if-block. Similarly, if you have an unconditional break / return in an else-block, it probably should have just been an if-block instead.