In an unusual public exchange, the director of the National Security Agency and a senior Yahoo executive clashed over cyber-spying Monday, illustrating the growing chasm between Washington and Silicon Valley over whether intelligence officials should have broad access to the products being developed by the nation's top technology firms.

For a normally staid Washington cyber-security conference, this one hosted by New America, the tense back-and-forth had the packed audience of executives, senior policy makers, bureaucrats and journalists buzzing.

Speaking at the signature event of the conference, NSA Director Adm. Mike Rogers called for a "legal framework" that would enable law enforcement and anti-terrorism officials to tap into encrypted data flowing between ordinary consumers -- echoing a stance laid out by other administration officials, including FBI Director James Comey and Attorney General Eric J. Holder. But technology executives as well as many cybersecurity experts argue there is no way to build in such "backdoors" without fundamentally undermining the security that protects online communications around the world. In response to recent revelations about government snooping, firms such as Apple and Google have designed their latest mobile software to make it impossible for the companies to turn over data from smartphones and tablet computers to police -- even when authorities have a search warrant.

Roger's remarks were later challenged by Alex Stamos, Yahoo's chief information security officer, during a question-and-answer session.

"So it sounds like you agree with Director Comey that we should be building defects into the encryption in our products so that the US government can decrypt…" Stamos began. (These remarks were verified by a transcript provided by the Web site Just Security.)

"That would be your characterization," Rogers said, interrupting him.

"No, I think... all of the best public cryptographers in the world would agree that you can’t really build backdoors in crypto," Stamos replied. "That it’s like drilling a hole in the windshield."

"I’ve got a lot of world-class cryptographers at the National Security Agency," Rogers said.

"I’ve talked to some of those folks and some of them agree too, but…" Stamos said.

"Oh, we agree that we don’t accept each others’ premise," Rogers replied, interrupting again, as laughter erupted across the audience.

A little bit later in the exchange, Stamos tried to bring up a different point.

"If we’re going to build defects/backdoors or golden master keys for the U.S. government, do you believe we should do so — we have about 1.3 billion users around the world — should we do for the Chinese government, the Russian government, the Saudi Arabian government, the Israeli government, the French government?" Stamos asked.

"So, I’m not gonna… I mean, the way you framed the question isn’t designed to elicit a response," Rogers replied.

"Well, do you believe we should build backdoors for other countries?" Stamos asked again.

"My position is — hey look, I think that we’re lying that this isn’t technically feasible. Now, it needs to be done within a framework. I’m the first to acknowledge that. You don’t want the FBI and you don’t want the NSA unilaterally deciding, so, what are we going to access and what are we not going to access? That shouldn’t be for us. I just believe that this is achievable. We’ll have to work our way through it. And I’m the first to acknowledge there are international implications. I think we can work our way through this," Rogers answered.

"So you do believe then, that we should build those for other countries if they pass laws?" Stamos asked a third time.

"I think we can work our way through this," Rogers replied.

"I’m sure the Chinese and Russians are going to have the same opinion," Stamos said.

"I said I think we can work through this," Rogers said.

Rogers, in his initial remarks, was also critical of former NSA contractor Edward Snowden, saying his disclosures revealed NSA surveillance tactics to terrorists.

“It has had a material impact on our ability to generate insights as to what terrorist groups around the world are doing,” he said.

For his part, Snowden, who has been in the limelight this week after a film documenting his efforts won an Academy Award, wrote Monday that he regretted not leaking his trove of secret documents earlier.

“Had I come forward a little sooner, these programs would have been a little less entrenched," Snowden wrote on the Web site Reddit. "And those abusing them would have felt a little less familiar with and accustomed to the exercise of those powers."