REUTERS Actors Will Smith and Gene Hackman in "Enemy of the State."

In the past week, details on two of the most closely guarded and controversial federal surveillance programs have been brought into the light of day and has turned the public perception of the shadowy National Security Agency into a potentially menacing and out of control organization.

And it’s not for the first time.

The 1998 Will Smith and Gene Hackman film Enemy of the State portrayed a rogue agency attempting to kill Smith’s character, a lawyer who they believe possesses information that would embarrass the agency.

“The government’s been in bed with the entire telecommunications business since the ’40s,” Gene Hackman’s character, a retired NSA official, tells Smith. “They have infected everything. They can get into your bank statements, computer files, e- mail, listen to your phone calls.”

Former NSA Director Gen. Michael Hayden was promoted to head the agency as the movie came out, and was deeply worried about the public perception it created, James Risen reported in his 2006 book State of War: The Secret History of the C.I.A. and the Bush Administration. Hayden, who went on to become the director of the CIA under President George W. Bush, “was appalled” by the NSA’s portrayal, and responded with a full-fledged PR campaign. The agency’s very existence was long a state secret.

“I made the judgment that we couldn’t survive with the popular impression of this agency being formed by the last Will Smith movie,” he told CNN in a segment pulling back the curtain on the agency.

“It has to be somewhat a secretive agency, and right in the middle of a political culture that just trusts two things most of all: power and secrecy,” he continued. “That’s a challenge for us, and that’s why, frankly, we’re trying to explain what it is we do for America, how it is we follow the law. Could there be abuses? Of course. Would there be? I am looking you and the American people in the eye and saying: there are not.”

With it’s current test far more real than a Hollywood blockbuster, it remains to be seen how the agency, and it’s director, Gen. Keith Alexander, will respond.

(h/t to former Romney senior adviser Stuart Stevens, who wrote the screenplay for a forthcoming HBO movie on the NSA and Bush’s domestic spying program.)