Base64 decodes str to a ByteArray after removing spaces, newlines, carriage returns, and tabs. Set url to true if str is Base64Url encoded.