Gene Hackman turned down this movie several times, but was ultimately convinced to sign on after a phone call by director Tony Scott. Will Smith later signed on at a relative post-Independence Day (1996) bargain price because he wanted to work with Hackman.
The N.S.A. refused to cooperate with the production. Aerial footage of their headquarters in Fort Meade, Maryland had to be shot from public air space.
Will Smith improvised Dean's line about buying the lingerie for himself to try cross-dressing on the weekends. Smith has said it was difficult to restrain his comedic instincts during a dramatic role.
The storm drain car chase scene was shot in a large air duct tunnel below the four main bores of the Fort McHenry Road Tunnel in Baltimore, Maryland. Fort McHenry permits Interstate 95 to pass under Baltimore's harbor. The air duct is only accessible via the tunnel's administration building by stairs and a small elevator, so the cars in the scene were chopped into several sections, taken three levels below, reassembled and painted. Once filming was complete they were disassembled once again and removed from the duct. The water was hosed in from a nearby sprinkler main.