The Catechism criticizes capital punishment as against human dignity. They are in one sense correct since punishment as such is contrary to human dignity at least in this sense: When one does something bad they enter a state of deserving a proportionate pain or loss, and this state as such is contrary to dignity, which is nothing but the state of deserving something good.
Of course, as soon as one suffers his proportionate pain or loss the state of punishment ends and the impediment to dignity is removed, meaning punishment also plays a role in restoring dignity. So punishment is medicinal at least when its completion takes someone out of the state of deserving evil. This is a narrower account of the corrective value of punishment than is usually assumed in liberal societies, as our “correctional facilities” or “reformatories” at least verbally seem to be committed not just to the paying of a pain debt but the transformation of the soul from vice to virtue. We are scandalized by repeat offenders and take them as proof that the prison system “isn’t working” – we even take a law’s inability to stop crimes as proof that the law isn’t working. While laws certainly play a role in making people virtuous, one minimal but essential part of this is simply that they inflict pain and loss, irrespective of what additional moral advance that they might contribute to. One who commits evil needs pain and loss to reëstablish his dignity irrespective of what he does with it once reëstablished, or even if the loss he deserves is the loss of his life.