Exact solver for the Kitaev model