A couple of weeks after hackers leaked several private, nude photos of celebrities, allegedly taken from iCloud accounts, Apple CEO Tim Cook has published an open letter explaining how the company handles personal information of users, as well as government requests for the same.

Cook started off by emphasizing that security and privacy are fundamental to the design of all Apple products, and said that the company will continue to make improvements. The iPhone maker recently rolled out two-step authentication for iCloud.com, and also announced that app-specific passwords for the online service will be available starting next month.

Taking indirect potshots at rival Google, Cook said, "We don’t build a profile based on your email content or web browsing habits to sell to advertisers...And we don’t read your email or your messages to get information to market to you".

Back in April, Google updated its terms of service, making it clear that it analyzes user data including emails to provide tailored advertising, customized search results, and other features.

Talking about iAd, Cook made it clear that the company's advertising network sticks to the same privacy policy that applies to every other Apple product, essentially meaning that it doesn’t get data from Health and HomeKit, Maps, Siri, iMessage, call history, or any iCloud service.

Finally, the letter also sought to reassure customers that Apple keeps their personal data safe from the prying eyes of government surveillance agencies. "I want to be absolutely clear that we have never worked with any government agency from any country to create a backdoor in any of our products or services. We have also never allowed access to our servers. And we never will."

In fact, with iOS 8, Apple says it has changed the way its encryption works so that it's technically impossible for the company to decrypt a device to access user data, even if law enforcement agencies request it.

The letter comes as Apple enters new markets like mobile payments, health tracking, and more, understandably because the company's success in these new areas depends greatly on the trust of its customers, which has been hampered by the latest celebrity photo leak scandal.