Shevuos, Chapter 4, Mishnah 1. This chapter opens with an in-depth discussion of the laws of the oath of testimony.
The definition of the oath of testimony:
A person claims that his fellow has testimony that would help his case, and his fellow answers that he knows nothing. The claimant may then say to him: even if you do not know, swear to me about it. If the fellow swears that he knows no testimony, and it later turns out that he did in fact know, he becomes obligated to bring a korban oleh v'yored (a sliding-scale offering).
To whom the oath of testimony applies:
"noheges ba'anashim v'lo banashim" - the oath applies to men alone, since only they are fit to testify, at least in monetary cases, whereas women are disqualified from testimony. Therefore, one who administers this oath to a woman who knows no testimony has accomplished nothing, since in any case she could not have testified.
"bir'chokin v'lo bik'rovin" - the oath applies specifically to those who are not relatives, since a relative is disqualified from testimony and is not fit to serve as a witness.
"bik'sherin v'lo bip'sulin" - only to those who are fit to testify, and not to those who have been disqualified from testimony, such as a wicked person who has transgressed the mitzvos of the Torah, and the like.
"v'eino noheg ela b'ra'ui l'ha'id":
Seemingly all of these were already included in the previous statements, so what does this addition come to teach? The Gemara explains that this statement comes to include - or more precisely, to exclude - the king, who cannot testify, as was explained in Maseches Sanhedrin. And besides the king, it comes to include also those who are disqualified from testimony by rabbinic law, such as one who plays with dice, and the like.
From his own mouth and from the mouth of others:
The oath applies "bifnei beis din v'shelo bifnei beis din" - whether he swore and denied knowledge before a beis din or not before a beis din. However, this is said specifically when the oath is "mipi atzmo" (from his own mouth): the claimant demands that he testify, and he responds on his own initiative, "shevuah she'eini yodea lecha edus" (I swear that I know no testimony for you) - this is an oath from his own mouth, and in such a case there is no difference between before a beis din and not before a beis din.
In contrast, when the oath is "mipi acheirim" (from the mouth of others), meaning that it comes out of the mouth of another person: the claimant asks the witnesses whether they know testimony for him, and they answer that they do not; he wishes to place them under oath and says to them, "I administer an oath to you that if you know testimony for him you should come and testify," and they respond, "We know no testimony for you." In this case they do not utter an oath from their own mouths, but merely deny in response to the oath, and they also do not answer amen - for we have already learned in this maseches that one who answers amen is considered as though he uttered the oath himself, and it is then no longer in the category of "from the mouth of others."
There is a dispute regarding this law:
Rabbi Meir: when it is from his own mouth, the oath applies both before a beis din and not before a beis din; but when it is from the mouth of others, even if they did not answer amen but merely denied after "I administer an oath to you" - "einan chayavin ad sheyichp'ru bahen b'veis din" - there is no obligation unless the denial took place before a beis din.
And the Sages say: "bein mipi atzmo u'vein mipi acheirim, einan chayavin ad sheyichp'ru bahen b'veis din" - whether he swore on his own or others uttered the oath in his presence and he denied it, there is no obligation unless the denial took place before a beis din.
The Gemara explains that the oath itself may be administered even outside of beis din, and the claimant may say "mashbia ani aleichem" - "I impose an oath upon you" - anywhere at all. The essential point of the Sages' ruling is directed at the denial: that is what must take place before beis din, both when the oath is administered by others and certainly when it is taken by the witnesses themselves. It is only that when the oath is taken by the witnesses themselves, what takes place in beis din is the oath itself, since in that case the denial is not separate from the oath - the oath is the denial.
In summary: In this Mishnah we learned the parameters of shevuas ha'eidus - one who swears that he does not know testimony, and it emerges that he did know, is obligated to bring a korban oleh v'yored. The oath applies to men and not to women, to unrelated parties and not to relatives, to those who are fit and not to those who are disqualified, and it applies only to one who is eligible to testify, excluding the king and those disqualified from testimony by rabbinic law. We also examined the distinction between an oath taken by the witnesses themselves and an oath administered by others, and the dispute between Rabbi Meir and the Sages as to when the denial must specifically take place before beis din.