Stewart Baker said that Apple and Google could be restricting their business in markets like China and Russia by encrypting user data

The battle over encryption of consumer internet users’ data has pitched US technology companies against the US government itself, former NSA general counsel Stewart Baker said on Tuesday.

Speaking at Web Summit in Dublin, Baker claimed that moves by Google and Apple and others to encrypt user data was more hostile to western intelligence gathering than to surveillance by China or Russia.

“The state department has funded some of these tools, such as Tor, which has been used in Arab Spring revolutions or to get past the Chinese firewall, but these crypto wars are mainly being fought between the American government and American companies,” he said, in conversation with Guardian special projects editor James Ball.

Baker said encrypting user data had been a bad business model for Blackberry, which has had to dramatically downsize its business and refocus on business customers. “Blackberry pioneered the same business model that Google and Apple are doing now - that has not ended well for Blackberry,” said Baker.

He claimed that by encrypting user data Blackberry had limited its business in countries that demand oversight of communication data, such as India and the UAE and got a bad reception in China and Russia. “They restricted their own ability to sell. We have a tendency to think that once the cyberwar is won in the US that that is the end of it - but that is the easiest war to swim.”

Baker said the market for absolute encryption was very small, and that few companies wanted all their employees’ data to be completely protected. “There’s a very comfortable techno-libertarian culture where you think you’re doing the right thing,” said Baker.

“But I’ve worked with these companies and as soon as they get a law enforcement request no matter how liberal or enlightened they think they are, sooner to later they find some crime that is so loathsome they will do anything to find that person and identify them so they can be punished.

“Tech companies are picking a big public fight with the NSA because it looks good, as opposed to changing the ability of government to get data,” he said. “The crypto wars have about as much to do with the outcome of security as the Soviet-Finnish war of 1939 had to do with the outcome of WW2.”

Matthew Prince, CEO of Cloudflare, defended the tech firms, saying these businesses depend on trust and that the Snowden revelations had been “a shot across the bow for companies like Google”.

“Where in the past there was a willingness to work with law enforcement, that time has gone,” he said. “I have faith in the math [of encryption]. No-one can monitor that - and I’m not sure we want private law enforcement taking on the law and picking which traffic is good or bad.”

Prince said that high profile security problems, including Heartbleed and Poodle, had demonstrated how mainstream security issues had become.

“But there is now a team at Google going line by line through the software that makes up the core foundation of the internet, and the ancillary effect of what is happening from Snowden is that we are building a better internet.”

• GCHQ chief accuses US tech giants of becoming terrorists’ ‘networks of choice’