views:

1973

answers:

3

I would like to verify that an app I am writing is running on an iPhone. What would be perfect is this: Apple baked an SSL client certificate into each iphone which can be authenticated by a receiving server. I this the case?

I have not started researching this yet, I will update with anything I find.

UPDATE: Here is some Apple documentation on certificates and keychains. So:

In iPhone OS, Keychain Services checks an application’s signature before giving it access to a keychain, and lets an application have access only to its own keychain items (with the possible exception of items for which the application has obtained persistent references). In iPhone OS, the user is never asked to authenticate and no Keychain Access utility is provided by Apple.

+1  A: 

I think that most sites that do this detection do so by looking at the HTTP_USER_AGENT variable.

Greg Hurlman
Which can be spoofed.
erickson
Yea, I was looking for something more secure than this.
Martin Redmond
Secure ain't gonna happen unless you install something onto each phone that visits your site.
Greg Hurlman
+1  A: 
erickson
A: 

Pertaining to what Greg mentioned above. You can definitely add a user agent to your header which we did in our application. There's more to the whole http connection code, but here's one way you could add the user agent to your header:

NSMutableURLRequest *request;
NSMutableDictionary *headers;
headers = [[[NSMutableDictionary allocWithZone:[self zone]] init] autorelease];
[headers setValue:@"YourApp/1.0 (iPhone)" forKey:@"User-Agent"];
[request setAllHTTPHeaderFields:headers];

Again, note that this code is only focused on the header bit, so you'll have to implement the complete http solution.

Rob
I fail to see what you are trying to accomplish here. Any http header can be forged by a normal web browser.
Rook