Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I want to get the list of certificates installed on iPhone or iPad. So I can use that to pick one and use for ssl verification at server. However I m not able to get this list. I have seen in this following link that it is not possible in iOS to get certificates as one can access only their own keychain. iOS get Configuration Profiles that are installediOS get Configuration Profiles that are installed

However I doubt :).

From the below link Get Certificates in KeychainGet Certificates in Keychain I m using the code to get certificates. However I m getting nil data.

NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)(kSecClassCertificate), kSecClass, [NSNull null], kSecMatchSearchList, kCFBooleanTrue, kSecReturnRef, kSecMatchLimitAll, kSecMatchLimit, nil]; CFDataRef *items = nil; OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, ((CFTypeRef *)&items)); 

I m giving [NSNull null] for search list with assumption that if keychain ref is NULL then device takes the default keychain.

My questions are

  1. Is it possible to get list of installed certificates from iPhone.
  2. If so how? What is wrong in the above code?

I want to get the list of certificates installed on iPhone or iPad. So I can use that to pick one and use for ssl verification at server. However I m not able to get this list. I have seen in this following link that it is not possible in iOS to get certificates as one can access only their own keychain. iOS get Configuration Profiles that are installed

However I doubt :).

From the below link Get Certificates in Keychain I m using the code to get certificates. However I m getting nil data.

NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)(kSecClassCertificate), kSecClass, [NSNull null], kSecMatchSearchList, kCFBooleanTrue, kSecReturnRef, kSecMatchLimitAll, kSecMatchLimit, nil]; CFDataRef *items = nil; OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, ((CFTypeRef *)&items)); 

I m giving [NSNull null] for search list with assumption that if keychain ref is NULL then device takes the default keychain.

My questions are

  1. Is it possible to get list of installed certificates from iPhone.
  2. If so how? What is wrong in the above code?

I want to get the list of certificates installed on iPhone or iPad. So I can use that to pick one and use for ssl verification at server. However I m not able to get this list. I have seen in this following link that it is not possible in iOS to get certificates as one can access only their own keychain. iOS get Configuration Profiles that are installed

However I doubt :).

From the below link Get Certificates in Keychain I m using the code to get certificates. However I m getting nil data.

NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)(kSecClassCertificate), kSecClass, [NSNull null], kSecMatchSearchList, kCFBooleanTrue, kSecReturnRef, kSecMatchLimitAll, kSecMatchLimit, nil]; CFDataRef *items = nil; OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, ((CFTypeRef *)&items)); 

I m giving [NSNull null] for search list with assumption that if keychain ref is NULL then device takes the default keychain.

My questions are

  1. Is it possible to get list of installed certificates from iPhone.
  2. If so how? What is wrong in the above code?
Notice removed Draw attention by CommunityBot
Bounty Ended with user529758's answer chosen by CommunityBot
Notice added Draw attention by sridevi
Bounty Started worth 50 reputation by sridevi
Source Link
sridevi
  • 627
  • 1
  • 6
  • 16

Get Certificates list from iOS device

I want to get the list of certificates installed on iPhone or iPad. So I can use that to pick one and use for ssl verification at server. However I m not able to get this list. I have seen in this following link that it is not possible in iOS to get certificates as one can access only their own keychain. iOS get Configuration Profiles that are installed

However I doubt :).

From the below link Get Certificates in Keychain I m using the code to get certificates. However I m getting nil data.

NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)(kSecClassCertificate), kSecClass, [NSNull null], kSecMatchSearchList, kCFBooleanTrue, kSecReturnRef, kSecMatchLimitAll, kSecMatchLimit, nil]; CFDataRef *items = nil; OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, ((CFTypeRef *)&items)); 

I m giving [NSNull null] for search list with assumption that if keychain ref is NULL then device takes the default keychain.

My questions are

  1. Is it possible to get list of installed certificates from iPhone.
  2. If so how? What is wrong in the above code?