Catechism of the Catholic Church

a, b, c, and e. Para. 1461: Since Christ entrusted to his apostles the ministry of reconciliation (Cf. Jn 20:23; 2 Cor 5:18), bishops who are their successors, and priests, the bishops' collaborators, continue to exercise this ministry. Indeed bishops and priests, by virtue of the sacrament of Holy Orders, have the power to forgive all sins "in the name of the Father, and of the Son, and of the Holy Spirit."
Para. 1462: Forgiveness of sins brings reconciliation with God, but also with the Church. Since ancient times the bishop, visible head of a particular Church, has thus rightfully been considered to be the one who principally has the power and ministry of reconciliation: he is the moderator of the penintential disciple (Cf. LG 26 § 3). Priests, his collaborators, exercise it to the extent that they have received the commission either from their bishop (or religious superior) or the Pope, according to the law of the Church (Cf. CIC, cann. 844; 967-969; 972; CCEO, can. 722 §§ 3-4).
Para. 1463: Certain particularly grave sins incur excommunication, the most severe ecclesiastical penalty, which impedes the reception of the sacraments and the exercise of certain ecclesiastical acts, and for which absolution consequently cannot be granted, according to canon law, except by the Pope, the bishop of the place or priests authorized by them (Cf. CIC, cann. 1331; 1354-1357; CCEO, can. 1431; 1434; 1420). In danger of death any priest, even if deprived of faculties for hearing confessions, can absolve from every sin and excommunication (Cf. CIC, can. 976; CCEO, can. 725).
Para. 1467: Given the delicacy and greatness of this ministry and the respect due to persons, the Church declares that every priest who hears confessions is bound under very severe penalties to keep absolute secrecy regarding the sins that his penitents have confessed to him. He can make no use of knowledge that confession gives him about penitent's lives (Cf. CIC, can. 1388 § 1; CCEO, can. 1456). This secret, which admits of no exceptions, is called the "sacramental seal," because what the penitent has made known to the priest remains "sealed" by the sacrament.