It shall be unlawful for any person to make, buy, sell or give away to any other person any duplicate key to any lock belonging to or in use by any railroad company in this State on its switches or switch tracks except upon the written order of that officer of such railroad company whose duty it is to distribute and issue switch lock keys to the employees of such railroad company. Any person violating any of the provisions of this section shall be guilty of a misdemeanor and for each and every offense shall be subject to a fine not exceeding one hundred dollars or imprisonment not exceeding thirty days.