My app allows the user to import a PKCS8 private key to use in the application which I will store in the keychain. The problem I am running into is how to handle the senario where the private key they want to use is already in the keychain. When I run this code
OSStatus err = SecItemImport((__bridge CFDataRef)keyData, NULL, &inputFormat, &itemType, kSecItemPemArmour, &importParameters, keychain, &items);
It is returning to me errSecDuplicateItem which is correct.
I need a way to reference that key in my application so how would I go about finding that duplicate?