The Catholic Church does not teach this, In fact, it is contained in the PRINCIPLES AND GUIDELINES of vatican.ca.“Penitential practices leading to self-crucifixion with nails are not to be encouraged.” [DIRECTORY ON POPULAR PIETY #144]
CONGREGATION FOR DIVINE WORSHIP
AND THE DISCIPLINE OF THE SACRAMENTS
ON POPULAR PIETY AND THE LITURGY
PRINCIPLES AND GUIDELINES
It is impossible for the Church to teach this since it is against the teachings of the Bible.
Repentance is not proven by wounding the body but through the act of repentance.
“I preached first to those in Damascus, then in Jerusalem and throughout all Judea, and also to the Gentiles, that all must repent of their sins and turn to God–and prove they have changed by the good things they do.”(Acts 26:20)