base64: Extended validation to look for invalid characters

Extended the basic validation in commit e17c1b25bc33eb to return a
failure when invalid base64 characters are included.