Yes. And ideally, the law will be written in such a way that nobody will ever have to break it. So, any situation where one might find it justified to use torture should or could be codified into the law.
But I am no longer sure what you are trying to say.
I am putting forth the idea that the goals of an individual may be very different from the goals of society -- this is common knowledge -- and that in some cases there is no need for society to attempt to reconcile this -- which is not.
So with torture, my claim is that on average, across society, the legalization of any form of torture would do much more harm than good. Even allowing for special cases. Thus, it should be outlawed completely.
My claim is also that for an individual, certain conditions may arise that make torture more beneficial than detrimental, even if they face the same torture as eventual punishment in return for their deeds. In such cases, the individual would be justified in torturing another.
However, the fact that the
individual is justified according to
their situation does
not mean they are justified according to
ours. In other words, I am saying that embracing a "double standard" here, rather than avoiding one, is a possible solution. If I was in that situation, yes, I would probably torture as well, but since I am not, and since most of us are not, then we cannot justify it, and must punish whoever does it.