2267 Assuming that the guilty party's identity and responsibility have been fully determined, the traditional teaching of the Church does not exclude recourse to the death penalty, if this is the only possible way of effectively defending human lives against the unjust aggressor.
However in 2267 it speaks about means of protection of a people without death to the aggressor.... in other words incarceration with dignity.
If, however, non-lethal means are sufficient to defend and protect people's safety from the aggressor, authority will limit itself to such means, as these are more in keeping with the concrete conditions of the common good and more in conformity to the dignity of the human person.
2268 and 2269 speaks some more on murder.
2268 The fifth commandment forbids direct and intentional killing as gravely sinful. The murderer and those who cooperate voluntarily in murder commit a sin that cries out to heaven for vengeance.
Infanticide, fratricide, parricide, and the murder of a spouse are especially grave crimes by reason of the natural bonds which they break. Concern for eugenics or public health cannot justify any murder, even if commanded by public authority.
2269 The fifth commandment forbids doing anything with the intention of indirectly bringing about a person's death. The moral law prohibits exposing someone to mortal danger without grave reason, as well as refusing assistance to a person in danger.
The acceptance by human society of murderous famines, without efforts to remedy them, is a scandalous injustice and a grave offense. Those whose usurious and avaricious dealings lead to the hunger and death of their brethren in the human family indirectly commit homicide, which is imputable to them.
Unintentional killing is not morally imputable. But one is not exonerated from grave offense if, without proportionate reasons, he has acted in a way that brings about someone's death, even without the intention to do so.