If you have a novel and non-obvious innovation, the USPTO will not deny you a patent simply because it is can be used for purposes that might be illegal in some circumstances.
While in many if not all jursidictions, a contract will not be enforceable if it's purpose is an illegal one. But intellectual property law is less judgmental. For example, the Sony/Betamax case in the 80s held that VCRs could be used for legal "timeshifting" even if they were also used for illegal copying. Similarly, patent applications aren't rejected if the patent in question is capable of some illegal use.
Disclaimer: Please note that this answer does not constitute legal advice, and should not be relied on, since each state has different laws, each situation is fact specific, and it is impossible to evaluate a legal problem without a comprehensive consultation and review of all the facts and documents at issue. This answer does not create an attorney-client relationship.
The Patent Office can deny a patent for morality reasons, but this is rarely done. If your device has a legal use, then it is unlikely that the Patent Office would deny your patent.
Disclaimer: the information provided herein is provided for informational purposes only. It is not intended to be legal advice or a legal opinion, or to be a substitute for legal advice or a legal opinion. Nor does author expect or intended that the reader will rely on the information provided in any legal matter at bar either ether currently or in the future. It strongly recommended that questioner seek legal counsel for a legal advice or an opinion on the subject matter discussed herein.