((a)) Whoever brings, carries, or possesses any dangerous weapon, instrument, or device, or any dynamite, nitroglycerin, or other explosive article or compound on board of any vessel documented under the laws of the United States, or any vessel purchased, requisitioned, chartered, or taken over by the United States pursuant to the provisions of , , as amended, without previously obtaining the permission of the owner or the master of such vessel; or
((b)) This section shall not apply to the personnel of the Armed Forces of the United States or to officers or employees of the United States or of a State or of a political subdivision thereof, while acting in the performance of their duties, who are authorized by law or by rules or regulations to own or possess any such weapon or explosive.