Apple is used to fighting and winning public relations battles. Apple’s refusal to comply with the U.S. federal government’s request to help the FBI gain access to the iPhone owned by one of the shooters in last year’s San Bernardino massacre, however, is going to be very hard to defend in the court of public opinion. If you want to understand why, you need look no further than the blistering attack on Apple today made by Senator Tom Cotton (R-Arkansas).

RELATED: Does Apple even have the ability to hack the iPhone like the FBI wants?

Cotton is very skilled in the dark art of political framing and he’s come up with an absolutely brutal frame to depict Apple as a company that aids and abets terrorism and other criminal activities. The passage in his statement that particularly struck me was his assertion that Apple is more concerned with protecting “a dead ISIS terrorist’s privacy over the security of the American people.”

Now, you may scoff at that and say that Apple merely understands that once it gives the FBI the tools to bypass key iPhone security procedures then those tools are very likely to end up in the hands of other intelligence agencies and of cybercriminals as well. After all, the FBI can’t even keep its own employees’ personal information safe — what makes anyone think that it will keep a lid on the secrets of bypassing iOS’s security passcode protocols?

That said, there’s a danger here that if Apple botches the politics of this fight that it could undermine public support for end-to-end encryption as a whole. In his letter to customers posted today, Apple CEO Tim Cook didn’t really make the distinction between what the FBI is asking Apple to do — that is, building specific features that can be used to bypass the iPhone’s passcode security protocols — and creating a backdoor that would undermine all encryption.

Anna Lysyanskaya, a computer science professor at Brown University who specializes in Cryptography, told me today that she’s worried that the average person won’t have much sympathy for Apple’s case against disabling its passcode data wipe features and that this could undermine the much more important fight to stop the government from mandating backdoors for encryption.

“It’s dangerous that Apple equates an encryption backdoor with software bypass because the public might not see the difference, and that may give the FBI leverage in the encryption backdoor debate,” she said.

Essentially, if the public concludes that Apple is being too overzealous in protecting the privacy of a dead terrorist, as Tom Cotton put it, then it might not object to giving the government special backdoors for encryption, which would be vastly more damaging than what the FBI is asking Apple to do right now.

And this brings us back to Cotton’s tirade against Apple today. Notice that he wasn’t just railing against Apple for refusing to help the FBI bypass the iPhone’s security passcode settings, he was railing against end-to-end encryption all together.

“The problem of end-to-end encryption isn’t just a terrorism issue,” he said. “It is also a drug-trafficking, kidnapping, and child-pornography issue that impacts every state of the union. It’s unfortunate that the great company Apple is becoming the company of choice for terrorists, drug dealers, and sexual predators of all sorts.”

Ominously, he said that the government would have to consider a legislative solution dealing with encryption because “Tim Cook and Apple have [shown] that they are unwilling to compromise.”

Is Cotton fear mongering? Of course he is. But we’ve seen in the past how fear can be used to override our better judgement. And if Apple is going to get into a fight with the government over this issue, it had better understand the hazardous trap that it’s walking into.