check the validity of the keys