Haynes v. United States, 390 U.S. 85 (1968)
The National Firearms Act of 1934 required the registration of certain types of firearms. Miles Edward Haynes was a convicted felon who was charged with failing to register a firearm under the Act. Haynes argued that, because he was a convicted felon and thus prohibited from owning a firearm, requiring him to register any firearms in his possession was requiring him to make an open admission to the government that he was in violation of the law, which was essentially a violation of his right not to incriminate himself.
As with many other 5th amendment cases, felons and others prohibited from possessing firearms could not be compelled to incriminate themselves through registration. The National Firearms Act was amended after Haynes to make it apply only to those who could lawfully possess a firearm. This eliminated prosecution of prohibited persons, such as criminals, and cured the self-incrimination problem. In this new form, the new registration provision was upheld. The court held: " To eliminate the defects revealed by Haynes, Congress amended the Act so that only a possessor who lawfully makes, manufactures, or imports firearms can and must register them"
Basically, you can only be prosecuted if you legally possessed the firearm in question.