iPhone client certificate

2019-05-05 14:50发布

问题:

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:

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



回答2:

A trusted platform module can do something along the lines that you are seeking. It's called remote attestation.

However, acceptance of trusted computing is limited—savvy consumers see it as a way for vendors to continue to exercise control over equipment and data that the consumer owns. Apple's grudging acknowledgment that DRM is stupid, as well as the extra cost of a TPM, would suggest the iPhone doesn't support this.



回答3:

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.