INTELLIGENCE agencies exist to steal secrets, and necessarily break other countries’ laws to do so. Much of the brouhaha around the disclosures by Edward Snowden, a fugitive systems administrator from America’s National Security Agency now living in Russia, misses that fact. But his latest leaks, published on September 5th in Britain’s Guardian and other outlets, highlight another aspect of the NSA’s work.

Purportedly, the NSA, with its British counterpart GCHQ, is trying not just to break the codes that allow private communication over the internet, but is sabotaging them. The tactics allegedly include undermining official standards bodies, and suborning big IT companies—if necessary, by infiltrating them. The aim is to insert “backdoors”: hidden flaws that help outsiders to eavesdrop. And the New York Times quotes a GCHQ document which says the NSA has “led an aggressive, multipronged effort to break widely used internetencryption technologies”. “Vast amounts” of encrypted data which used to be discarded are now “exploitable”.

This is big news, if true. For most of history, cryptography was an arcane discipline, of interest only to mathematicians and to some parts of government, just as the internet was once an academic research network that paid little attention to security. Now encryption of electronic data is an essential part of modern life. It secures the financial networks that link the world’s banks, protects credit cards, stops mobile-phone calls from being listened to, guards medical records and lawyers’ letters to their clients. Though cybercrime is a growing menace, reliable encryption remains the foundation on which the trillion-dollar edifice of e-commerce is built: without it, nobody would be able safely to make a payment online. For critics, sabotaging such codes is akin to a government secretly commanding lockmakers to make their products easier to pick—and to do so amid an epidemic of burglary.

Researchers, civil libertarians and conspiracy theorists have long suspected that policemen and spies would take steps to hamper individuals’ access to the uncrackably strong codes that modern computers can create. These bring privacy—but give great scope to villains. In the 1990s America classed cryptography as a weapon, and let only weakened versions of it be sold abroad. Western spies were rumoured to have installed “backdoors” into equipment sold by Crypto, a Swiss firm which exported to the Libyan and Iranian governments (the firm denied it). Some export versions of Lotus Notes, a rival to Microsoft’s Office suite of software, came with weakened secrecy. In 1999 researchers unearthed signing software suspiciously entitled “_NSAKEY” in some versions of Microsoft Windows (the company denied that it was a backdoor).

But outsiders have mostly relied on guesswork. After the latest revelations experts are scrambling to work out what the spies might have done, which encryption is affected and what will happen next. Intriguingly, Mr Snowden himself has said that “properly implemented strong crypto systems are one of the few things that you can rely on”. The question is what he means by “properly implemented”.

“Before this happened, wondering about government backdoors had the whiff of conspiracy theory,” says Matthew Green, of Johns Hopkins University, in Maryland. “But now it’s the exact opposite…Everything is suspect.” People are wondering where backdoors do not exist, rather than where they do. Mr Green sees three kinds of possible attack: on cryptographic standards, on software and on hardware.

Your keys, please

In theory, standards should be the hardest to subvert. They define the maths and techniques that encryption schemes use. They are poked and prodded by both academic cryptographers and government agencies (including the NSA itself, in its advisory role) to ensure that they are strong.

But the agency has made some strange-looking recommendations over the years. Cryptography depends on random numbers. These are hard for computers, which are decidedly non-random machines, to generate. Making random-number generators less random would be a fine, and subtle, way to undermine secrecy. In 2006 the NSA supported a random-number generator that was 1,000 times slower than its closest competitor. Researchers later found a problem which could badly weaken any encryption that relied on it.

Cryptography also depends on so-called “trapdoor functions”, bits of mathematics that are easy to do in one direction but virtually impossible to reverse. One common method is based on the assumed difficulty of finding the prime factors of enormous numbers. But the NSA (and many security researchers) have also been touting new codes based on a different sort of mathematics involving elliptic curves. This encryption should be stronger and less computationally taxing. But its equations require some constants. Bruce Schneier, a cryptographer and security commentator, frets that the NSA may have picked those constants so as to make the resulting codes vulnerable to decryption. He has no proof, he stresses, but “I think it’s a good guess that the NSA knows something about elliptic curves that we don’t. So I don’t trust them.” (Mr Schneier has seen many of Mr Snowden’s source documents but says his suspicions do not arise from studying them. He did not discuss them with The Economist.)

Software should be slightly easier to sabotage. One of the most commonly used cryptographic suites on the internet is written by Microsoft. Other leaks indicate that the firm has been subject to considerable legal pressure from American intelligence. Its code is “closed-source”, meaning that it is hard for outsiders to see how the programs work. “Open-source” software—where code is open for anyone to inspect—abounds, and should offer a bit more security. But flaws crop up there too. A random-number generator in Debian, a version of the open-source Linux operating system, had been misfiring for nearly two years before it was spotted in 2008. How many such bugs are accidental?

Dodgy hardware is even harder to find. The routers and switches that marshal traffic around the internet are largely designed by American firms; bugs infest them as well (a big one was found in 2011). Chips themselves have millions of transistors and complex embedded software. Inspecting one thoroughly is immensely difficult and costly. Intel, the world’s biggest chipmaker, builds a random-number generator into its products. Steve Blank, a Silicon Valley veteran, has publicly wondered whether America’s spies might have modified those chips (with or without Intel’s knowledge) to make the numbers less random. Intel says: “We do not include backdoors or any other unauthorised access to our products.”

But what once seemed paranoia is now a growing worry. Mr Schneier’s guess is that “the odds are almost zero that the NSA hasn’t tried to influence Intel’s chips.” In 2012 a paper from two British researchers described an apparent backdoor burned into a chip designed by an American firm called Actel and manufactured in China. The chip is widely used in military and industrial applications. Actel says the feature is innocent: a tool to help its engineers fix hardware bugs.

Who cares?

The NSA and its allies see things differently. For intelligence professionals, the efforts to compromise commercial products are a tempest in a teapot. Time was when the nation’s adversaries used military and diplomatic codes. Now they use private ones, too. So, they say, the NSA naturally must change the focus of its work, just as it now must target individual terrorists as well as foreign leaders. Are the critics really saying that the NSA must give up its work (or publicise its methods, rendering them useless)? Polls suggest a narrow majority of Americans, at least, prefer safety.

Moreover, aver the NSA’s defenders, the idea that commercial cryptography is now useless is false. The software and hardware is still robust enough to protect the integrity of communications for most uses. Only someone with oodles of skill and computing power can break it. That is well beyond the abilities of cyber-criminals. Even if they stumble across one or two security flaws, they will not have the ability to exploit them. If the NSA or allied agencies need a subtle way to access the material they need at a moment’s notice, that is useful, not scandalous.

Civil libertarians are unconvinced. They want to live in a world in which secure communication is at least theoretically possible. Less high-minded types worry, too. Security researchers dislike backdoors because they could be useful not just to their architects, but to malefactors. If the main protection against this is obscurity, then given the numbers of enthusiasts, crooks and spies who poke around other people’s computer systems, it may prove flimsy. (For other countermeasures, see article.) If the cryptography that secures e-commerce or banking has a built-in vulnerability, and a rogue outsider discovers it, the consequences could be catastrophic. Mr Snowden’s leaks will have brought more hunters to that quest.

Some companies will gain from the latest disclosures. “The unintended consequence of all this is that we are about to enter the next great wave of cryptographic research,” says Matthew Prince of CloudFlare, which makes products to speed up and protect websites. Wickr, an American outfit that makes a highly secure messaging app, is one of those already profiting from the panic. “Our downloads have grown tremendously since the NSA revelations,” says Nico Sell, a co-founder.

But overall, the damage seems likely to far outweigh the benefits. America’s public image has taken a pounding: its courts, laws and politicians seem unable to supervise the spooks properly. Whistleblowers—supposedly cherished by the Obama administration—are persecuted, not vindicated. The NSA, a recent leak suggests, is spying not just on foreign adversaries, but also American companies’ commercial rivals, something that foreign firms and governments have worried about for years. James Clapper, the director of national intelligence, faces an uphill struggle in his argument that America spies on business communications, but only to give early warning of financial crises and the like, not to give American firms a boost. Even those who mistrust Mr Snowden and his allies, who contest the inferences drawn from the leaks, and defend the role of the NSA, acknowledge the harm done by the supposedly super-secret agency’s inability to keep its own systems secure. The most immediate damage is to America’s leading technology firms. They were already battling to contain the damage caused by previous allegations of how the NSA hoovered up their customers’ data. Protectionists can now pose as champions of privacy and national dignity. German politicians have urged people to shun American web firms if they want to keep their data secure. The Indian government is reportedly considering a ban on the use of Google’s Gmail service for sending official communications. And tech firms in places like Switzerland have seen a spike in inquiries from companies looking for a haven for their data. Some experts play this down. It would be naive to think that the NSA did not have such capabilities. Lawrence Pingree of Gartner, a research firm, says some American “cloud computing” firms, which store and help manage other firms’ data, could see a dip in business, but he reckons the overall impact will be “minimal”. But a report by the Information Technology and Innovation Foundation, a think-tank, estimates the leaks could cost that industry $22 billion-35 billion in lost revenues between now and 2016. Some customers may shun technology with any American connection. Some may have to because their governments pass laws mandating the use of local cloud operators for certain kinds of data.

American telecoms-equipment makers such as Cisco could also lose business abroad to foreign rivals—not least to Huawei, a controversial Chinese rival. Concerns about possible ties to Chinese espionage (which it denies) have hampered its expansion in America. William Plummer, its spokesman, says the industry should work together to secure networks and data, while putting “political games and distracting country-of-origin shenanigans behind us”.

But America’s big consumer internet firms, with their global horizons, have the most to lose. On September 9th several of them, including Google and Yahoo, filed new or revised lawsuits with America’s Foreign Intelligence Surveillance Court requesting permission to reveal more detailed information about the kinds of requests they receive from American government agencies. Both firms made clear in their suits that their inability to respond to misleading surveillance-related stories with specific data about such requests had harmed their reputation and their business, though they did not put a figure on the damage done.

Now America’s tech giants stand accused not just of mishandling their customers’ data, but, in effect, of knowingly selling them flawed software. Microsoft has always denied installing backdoors. It says it has “significant concerns” about the latest leaks and will be “pressing the government for an explanation”.