Every person who shall solemnize a marriage when either party thereto is known to him or her to be under the age of legal consent or a marriage to which, within his or her knowledge, any legal impediment exists, shall be guilty of a gross misdemeanor.