Upon the entry of every vessel of the United States from any foreign port, if the same shall be at the port at which the owner or any of the part owners reside, such owner or part owner shall make oath that the register of such vessel contains the name or names of all the persons who are then owners of the vessel; or if any part of such vessel has been sold or transferred since the granting of such register, that such is the case, and that no foreign subject or citizen has, to the best of his knowledge and belief, any share, by way of trust, confidence, or otherwise, in such vessel. If the owner or any part owner does not reside at the port at which such vessel enters, the master shall make oath to the like effect. If the owner, or part owner, where there is one, or the master, where there is no owner, refuses so to swear, such vessel shall not be entitled to the privileges of a vessel of the United States.