Confession (Reconciliation) is a Sacrament instituted by Christ for the forgiveness of sins. The priest or bishop is bound by secrecy not to reveal the contents of the confessional.
During his lifetime Christ sent out his followers to do his work. Just before he left this world, he gave the apostles special authority, commissioning them to make Gods forgiveness present to all people, and the whole Christian world accepted this, until just a few centuries ago. If there is an “invention” here, it is not the sacrament of penance, but the notion that the sacramental forgiveness of sins is not to be found in the Bible or in early Christian history. (From Catholic answers)
Excommunication ferendae sententiae can be public only, as it must be the object of a declaratory sentence pronounced by a judge; but excommunication latae sententiae may be either public or occult.
scripture