An extract from A Commentary on the New Code of Canon Law (1918) by Fr Charles Augustine:
"As long as public confession, at least for public and heinous crimes, and consequently public penance were in vogue, the sacramental seal naturally was not often mentioned. But when, after the incident at Constantinople, auricular confession became more frequent, nay common, the clergy had to be advised and enjoined to take heed lest they revealed anything that had been confessed in secret. St. Augustine demands of the priest that he, like a wise and perfect physician, first heal his own sores and then cure the wounds of others, and not make them known. Leo the Great indicates the reason why auricular confession and the subsequent secrecy were commendable when he says men are more readily induced to confess their sins if their conscience is kept from the ears of the people. A very remarkable text is that of the Decretals which says that what the priest knows from confession, he knows not as a (public) judge, but as God. Hence under no pretext can the confessor be forced to reveal the crimes confessed to him.
The seal of the confessional rests on natural, divine, and ecclesiastical law. The natural law dictates that an entrusted secret should never be revealed; it is privileged knowledge which even the civil courts respect in publicly acknowledged persons for the welfare of the community. The divine law demands that what is connected with a divine institution, such as confession, should be kept from profane ears, or, as the text above quoted says, that the secrets of God should not be revealed unless He gives permission to do so. But it would be absurd to assert that Christ permits such a revelation, because He knew that confession was a grievous burden, which would become intolerable if it impaired the penitent's good name. The divine precept of confessing even secret sins also demands absolute secrecy.
The ecclesiastical law inflicts the severest punishments on the transgressors of this divine command, subjecting those who directly violate the seal of confession to that form of excommunication which is most especially reserved to the Apostolic See.
The seal is violated directly if a sin confessed in the confessional or the name of the penitent is revealed; indirectly, if from the confessor's way of acting or speaking there is danger that the sin of the penitent be made known or that confession itself becomes hateful. It would be an indirect violation if the priest would ask questions in such a loud voice that the bystanders could understand them, or if he would use gesticulations known to bystanders as indicative of certain sins.
The custom of giving certificates (schedula confessionis) to those of the faithful who are admitted to Holy Communion has been deservedly rebuked. However, it is permissible to give a certificate which testifies to the fact that the bearer has received both the Sacrament of Penance and Holy Communion. Another custom was also reproved by the S. Congregation. Some missionaries were accustomed to put exactly as many particles on the patena as there had been persons absolved and admitted to Holy Communion. This they could not do except by using sacramental knowledge, and the practice was therefore rebuked as an abuse.
From all that has been said it appears how careful the Church is in guarding the sacramental secret. No power on earth can compel the confessor to reveal anything he has heard in the confessional.
It obliges by virtue, not of the divine, but of the natural and ecclesiastical law, which latter threatens severe punishment against transgressors, i.e., such as obtain and make use of the knowledge obtained in confession. Thus, if a confessor directly or indirectly reveals anything out of confession, the hearers are bound to keep such knowledge to themselves. Interpreters are strictly bound to silence; bystanders who may perchance hear something said in confession are likewise obliged to secrecy. Theologians and consultors are bound by the present law unless the one seeking advice frees them from this obligation. One who finds a list of sins drawn up for confession, is bound to keep it secret."