Quick Answer: In a way, Yes.
This is a somewhat technical question that requires great attention. The Church consider’s the death penalty as a way for the State to defend itself; a society’s version of self-defense. Everyone knows that each person has the right to protect themselves from any lethal attack. The death penalty is a way society takes the decision of defending itself from unrepentant murderous criminals.
The Church doesn’t teach that just because someone is guilty of a capital crime he should be simply executed. No. Capital punishment is only moral in particular circumstances not in every circumstance. The State must be morally certain that the individual is not only guilty of grave crime, but also that the State has no other means of protecting itself especially from such people who do not show sufficient evidence of remorse. I personally believe that the morality of the death penalty isn’t something that can be discussed without referring to particular cases, therefore the morality of each case depends on how prudent the judgement.
Therefore, the death penalty, by its nature, cannot be wrong all the time just as killing someone in order to defend yourself or others from lethal attack cannot always be morally wrong. So at every time, there’s always need for society to make such difficult decision to protect her citizens.