Section 31. A director, treasurer or other officer or agent of a company who knowingly votes to authorize the issue of, or knowingly signs, certifies or issues, stock or bonds contrary to any provision of section twenty-eight or twenty-nine, or who knowingly votes to authorize the application, or knowingly applies the proceeds, of such stock or bonds contrary to any provision of said sections, or who knowingly votes to assume or incur, or knowingly assumes or incurs in the name or behalf of such company, any debt or liability except for legitimate purposes of the company shall be punished by a fine of not more than one thousand dollars or by imprisonment for not more than one year, or both.