clear error queue on success and return NULL if no cert could be read