The new counter-terrorism law, recently drafted by Chinese lawmakers and expected to be adopted this year, would require technology companies to give Beijing details of their encryption methods or be denied access to the Chinese market.
It has alarmed some US-based tech companies and today drew criticism from Obama, who said he had raised the issue directly with Chinese President Xi Jinping.
"We have made it very clear to them that this is something they are going to have to change if they are to do business with the United States," Obama told Reuters in Washington.
Beijing's foreign ministry defended the law as purely internal and "a requirement for the Chinese government to prevent and combat terrorism".
More From This Section
"The legislation is China's domestic affair," spokeswoman Hua Chunying said at a regular news conference, calling on Washington to "view it in a correct and objective way".
She also noted that "not too long ago, it was disclosed that some country embedded spying software for surveillance in SIM card cardmakers".
The statement was an apparent reference to reports last month that European SIM maker Gemalto had suffered hacking attacks believed to have been conducted by US and British intelligence agencies.
Washington last May charged five Chinese military officers with breaking into US computers for industrial espionage purposes.
China denied the charges and soon afterwards angrily suspended a newly-formed cyber-security working group.