Before the witnesses are examined, their names are to be communicated to the parties; if in the prudent judgment of the judge, however, that cannot be done without grave difficulty, it is to be done at least before the publication of the testimonies.
Source: Code of Canon Law (Vatican.va)