[What you need to know to start the day: Get New York Today in your inbox.]

Not long after his 21st birthday, Christian Rodriguez got the contract of a lifetime for his new info-tech company: The Colombian was hired as a cybersecurity consultant by Joaquín Guzmán Loera, the Mexican drug lord known as El Chapo.

While Mr. Rodriguez had little experience or formal education, he had been recommended by one of his other clients: Jorge Cifuentes Villa, a veteran trafficker who worked with Mr. Guzmán making cocaine deals with left-wing guerrillas in Colombia.

And so in 2008, the ambitious, young techie visited Mr. Guzmán at one of his hide-outs deep in the Sierra Madre mountains, inspecting the kingpin’s communications system and his shoddy internet setup, which often broke down when it rained. In several follow-up meetings, Mr. Rodriguez testified this week, he pitched Mr. Guzmán on an elaborate plan to enhance his information security, offering to build him a private phone network that ran on the internet and was totally encrypted.

That sophisticated system was, within three years, used against Mr. Guzmán after Mr. Rodriguez became ensnared in an F.B.I. sting operation and was then persuaded to become an informant. The I.T. expert helped the American authorities secretly collect a vast trove of the kingpin’s phone calls and text messages — among them, dozens he had sent to his wife and mistresses. In two days of testimony that ended on Thursday, Mr. Rodriguez told this riveting story to great — and damaging — effect at Mr. Guzmán’s drug conspiracy trial in Federal District Court in Brooklyn.