Hi,
I'm adding certificate to keychain as describe Here
I add the certificate to keychain successfully but when I try to fetch it, it always return error item not found (25300)
I'm running on macOS Big Sur (ver 11.6)
Below is the code. What am I missing ?
Thanks,
Tal
// code that insert the certificate
NSDictionary* addquery = @{
(id)kSecValueRef: (__bridge id)cert,
(id)kSecClass: (id)kSecClassCertificate,
(id)kSecAttrLabel: @"ClientCert"};
OSStatus status = SecItemAdd((__bridge CFDictionaryRef)addquery, nullptr);
// code that fetch the certificate
NSDictionary *queryDict = @{
(id) kSecClass : (id) kSecClassCertificate,
(id) kSecAttrLabel : @"ClientCert",
(id) kSecReturnRef : @YES};
auto sanityCheck = SecItemCopyMatching((__bridge CFDictionaryRef) queryDict, (CFTypeRef *) &m_client_cert);