States don't participate in duty-based ethics. They offer or impose social contracts. So the result of trying to adopt a consistent personal ethics based upon abstract duty within a state context ultimately results in a sort of 'theory sandwich', a layered approach to ethics where the layers clearly conflict, and one or the other is taken to be primary in different contexts.
If you want to wrap acceptance of a social contract inside a Kantian duty, you would first need to determine to what degree the state itself is to be presumed to be negotiating in good faith.
Betrayal of an agreement made in good faith is not universalizable. None of us would accept living in so chaotic a world that no contract could be made that holds weight. So if you unconditionally accept the state as well-motivated, obeying the law becomes a primary concern.
But few of us have this understanding of our own state. We know that the state is in fact motivated to serve ends other than those it states. Entering into a contract that is itself not properly motivated is not universalizable. It involves compromising your ultimate autonomy, which is contrary to the principle of duty to begin with. One cannot allow oneself to make oneself a mere means to the making of others into mere means, just in order to avoid responsibility for future ethical actions.
States that are founded in their own acknowledged violation of other states rights, like the U.S., have to recognize this conflict, and they end up writing flexibility around the conflict into the law, institutionalizing the idea that obedience of the law may be subject to assent of personal conscience. In the U.S., this is done by amending the rights of the state with a requirement that it not curtail free practice of religion.
This gives us an out, since the set of religions that law is specifically aimed at includes informal religions based primarily upon practice of the conscience (Historically, Quakerism was the state religion of one of the original colonies, Pennsylvania. And it does not matter whether you actually are a Quaker, but whether controlling you in this way would make it impossible for you to be one. So personal conscience is protected by the First Amendment, to a considerable degree.)
In that (this) kind of state, the question of which way around to wrap the two systems is allowed for in the social contract itself. Personal conscience is primary, as long as it is honest. There may well be legal consequences to disobedience, but those consequences are limited by respect for your 'personal beliefs' up to the point where those beliefs threaten to make the entire social contract unenforceable.
So the party with whom you have contracted actually does not expect compliance, which makes life a bit simpler. You have wronged no one, if you refuse to comply with the law because it would constitute breaking some sort of implied obligation of conscience. You either have or have not communicated that bond of duty to the other party, and the call is based upon your intentions, and not their understanding.
In a State with a less compromising history, this becomes a much more complex problem.