US and German intelligence services secretly gathered the classified communications of governments for decades through secret control of an encryption company, reports say.
Swiss firm Crypto AG supplied encoding devices to more than 120 governments from the Cold War era up to the 2000s.
But the spies reportedly rigged the devices so they could crack the codes and read the messages.
They harvested secrets from countries including Iran, India and Pakistan.
The highly-classified programme between the US Central Intelligence Agency (CIA) and Germany's BND Federal Intelligence Service has been detailed in reports by US newspaper the Washington Post, German broadcaster ZDF and Swiss channel SRF.
The outlets gained access to a classified internal CIA history that called the operation the "intelligence coup of the century".
In the 1980s, roughly 40% of foreign communications processed by US intelligence officials had been supplied through Crypto's machines.
The company made millions of dollars in profits that went to the CIA and BND.
"Foreign governments were paying good money to the US and West Germany for the privilege of having their most secret communications read by at least two (and possibly as many as five or six) foreign countries," wrote a report by the CIA into the operation.
The operation enabled the US to monitor Iranian officials during the 1979 hostage crisis, as well as feed intelligence to Britain about Argentina's military during the Falklands War, according to the Washington Post.
Russia and China never trusted the machines, and did not use them.
Swedish firm Crypto International, formed after part of the original company was acquired by an investor in 2018, said it had "no connections to the CIA or the BND" and was very distressed by the reports.
The Swiss government says it was informed of the case last November and has named a retired federal judge to investigate.
By the BBC's Imogen Foulkes in Geneva
There are whimpers of anguish across Switzerland.
'Our reputation is in tatters,' sighs one political journalist. 'Our neutrality is a hypocrisy,' writes another.
In fact the dodgy dealings of Crypto AG were rumoured for years. Crypto's Swiss employees suspected something was wrong.
The Swiss government knew all along: it was one of the only governments which received a Crypto machine the CIA had not tampered with. But having the whole sorry story plastered across the world's media is painful.
It reminds the Swiss of an image they have been trying hard to rid themselves of; that they will do anything for the right price.
Their banks once looked after billions looted by dictators, they turned a blind eye to tax evasion on a massive scale.
All that is supposed to be in the past, but now another proud sector, Switzerland's precision engineering, looks tawdry too.
The CIA used Crypto AG precisely because Switzerland's reputation for neutrality and quality would attract buyers in governments around the world.
Switzerland took the money, and sold flawed machines. And now everybody knows.
A Russian-born Swedish inventor called Boris Hagelin created the portable encryption machine when he fled to the US during the Nazi occupation of Norway in the 1940s.
It was small enough to be used in the field and was supplied to around 140,000 US troops.
Image copyright Getty Images
Boris Hagelin and his wife fled to the US during World War Two
When WW2 ended, Hagelin moved to Switzerland.
His technology became so advanced that the US government worried it would stop them spying on other governments' communications.
But the top US codebreaker, William Friedman, persuaded Hagelin to sell the most advanced machines only to countries approved by the US.
The older machines, which the CIA knew how to access, were sold to other governments.
In the 1970s, the US and Germany bought Crypto and controlled almost the entire operation, including hiring staff, designing the technology, and directing sales.
The intelligence-gathering hidden in the rigged machines was long suspected but never previously proven.