תהלים פרק קכב פסוק ד in Rashi. I don't know the Talmudic source offhand.
If all the women were moral, then there would be no one for the men to be immoral with. Egyptian women would not lower themselves be with slaves. Also any children by a man and some other woman would not be a member of the husband's tribe. Thus the certification of Hashem applies to both the men and the women.
4 There ascended the tribes, the tribes of God, testimony to Israel, to give thanks to the name of the Lord.
Rashi
the tribes of God: Heb. י-ָהּ, which is testimony to Israel, for the heathens were talking about them when they left Egypt, and they would say about them that they were the offspring of adulterous unions. If the Egyptians ruled over their own bodies, surely [they ruled] over their wives. Said the Holy One, blessed be He, “I attest that they are the sons of their fathers.” He bestowed His name upon them: the Reubenites (הראובני), the Simeonites (השמעוני) (Num. 26). He added the letters of the name, one on this side and one on that side. The result is that this name י-ָהּ is testimony to Israel.