You can't own a firearm if you consume marijuana, so using the 2nd amendment for things like encryption might get interesting. The 2nd amendment allows for heavy regulation of arms.
> You can't own a firearm if you consume marijuana [...]
While BATF Form 4473 and the Gun Control Act may lead some to conclude that you cannot be "addicted to marijuana" and simultaneously legally possess a firearm, consider that many laws are on the books that would likely be adjudicated unconstitutional. The second amendment concludes with "shall not be infringed", and denying somebody their right to possess a firearm (for any reason) appears to be an infringement of that right, according to the second amendment.
> The 2nd amendment allows for heavy regulation of arms.
I'd be curious to hear what leads you to believe this. The language of the second amendment is clear, and the founder's intentions even more so. If you're developing your view based on the term "well-regulated", go do a bit of research on what that term meant when the Bill of Rights was authored (hint: it's different than what "regulated" is often interpreted to mean in 2022).
The federal application for a Federal Firearms License, the license needed to be a firearm vendor, not the (as far as I can tell) non-existent federal license to own one?
It isn't just FFLs. The Gun Control Act (GCA) defines a list of people who aren't allowed to ship, transport, receive, or possess firearms of ammo. This includes any person "who is an unlawful user of or addicted to any controlled substance (as defined in section 102 of the Controlled Substances Act, codified at 21 U.S.C. § 802);" [1]. Since cannabis is federally illegal still if you use it you can't legally even possess (not just own) a firearm or ammo.
I think it is a stupid law though. Imagine if we applied that logic to other constitutionally protected rights. "Anyone who is an unlawful user of or addicted to any controlled substance shall not have the right to vote" or "Anyone who is an unlawful user of or addicted to any controlled substance shall not have the right to due process".
Admittedly, it's hard to kill another person by voting, or receiving due process. And we do restrict speech when it verges on violence (imminent lawless action, fighting words).
> "Anyone who is an unlawful user of or addicted to any controlled substance shall not have the right to vote" or "Anyone who is an unlawful user of or addicted to any controlled substance shall not have the right to due process".
Not the same thing at all, because a firearm is directly and irrevocably more dangerous while under the influence of drugs.
You can debate the tradeoff of "right to bear arms" vs "right to regulate arms" (just as voting has gone through lots of regulations, some terrible (black people, women), some OK or debatable (showing proof residence or citizenship somewhere in the process), but it's not obvious simply by analogy to other rights.