The second commandment forbids the abuse of God's name, i.e., every improper use of the names of God, Jesus Christ, but also of the Virgin Mary and all the saints.
CCC 2150
Promises made to others in God's name engage the divine honor, fidelity, truthfulness, and authority. They must be respected in justice. To be unfaithful to them is to misuse God's name and in some way to make God out to be a liar (Cf. 1 Jn 1:10).
Blasphemy is directly opposed to the second commandment. It consists in uttering against God - inwardly or outwardly - words of hatred, reproach, or defiance; in speaking ill of God; in failing in respect toward him in one's speech; in misusing God's name. St. James condemns those "who blaspheme that honorable name [of Jesus] by which you are called." (Jas 2:7) The prohibition of blasphemy extends to language against Christ's Church, the saints, and sacred things. It is also blasphemous to make use of God's name to cover up criminal practices, to reduce peoples to servitude, to torture persons or put them to death. the misuse of God's name to commit a crime can provoke others to repudiate religion.
Blasphemy is contrary to the respect due God and his holy name. It is in itself a grave sin (Cf. CICCodex Iuris Canonici (Code of Canon Law), can. 1369).
Oaths which misuse God's name, though without the intention of blasphemy, show lack of respect for the Lord. the second commandment also forbids magical use of the divine name.
[God's] name is great when spoken with respect for the greatness of his majesty. God's name is holy when said with veneration and fear of offending him (St. Augustine, De serm. Dom. in monte 2, 5, 19: PLPatrologia Latina (J. P. Migne) 34, 1278).
The second commandment forbids false oaths. Taking an oath or swearing is to take God as witness to what one affirms. It is to invoke the divine truthfulness as a pledge of one's own truthfulness. An oath engages the Lord's name. "You shall fear the LORD your God; you shall serve him, and swear by his name." (Deut 6:13)
Rejection of false oaths is a duty toward God. As Creator and Lord, God is the norm of all truth. Human speech is either in accord with or in opposition to God who is Truth itself. When it is truthful and legitimate, an oath highlights the relationship of human speech with God's truth. A false oath calls on God to be witness to a lie.
A person commits perjury when he makes a promise under oath with no intention of keeping it, or when after promising on oath he does not keep it. Perjury is a grave lack of respect for the Lord of all speech. Pledging oneself by oath to commit an evil deed is contrary to the holiness of the divine name.
In the Sermon on the Mount, Jesus explained the second commandment: "You have heard that it was said to the men of old, 'You shall not swear falsely, but shall perform to the Lord what you have sworn.' But I say to you, Do not swear at all.... Let what you say be simply 'Yes' or 'No'; anything more than this comes from the evil one." (Mt 5:33-34, 37; Cf. Jas 5:12) Jesus teaches that every oath involves a reference to God and that God's presence and his truth must be honored in all speech. Discretion in calling upon God is allied with a respectful awareness of his presence, which all our assertions either witness to or mock.
Following St. Paul (Cf. 2 Cor 1:23; Gal 1:20), The tradition of the Church has understood Jesus' words as not excluding oaths made for grave and right reasons (for example, in court). "An oath, that is the invocation of the divine name as a witness to truth, cannot be taken unless in truth, in judgment, and in justice." (CICCodex Iuris Canonici (Code of Canon Law), can. 1199 # 1)