in macos/macos.c [116:138]
OSStatus FetchSEKey(
const char* label,
const char* tag,
unsigned char* hash,
CFDataRef* pubKey) {
SecKeyRef key = NULL;
OSStatus status = FetchSEPrivKeyRef(label, tag, hash, &key);
if ((status != errSecSuccess && status != errSecItemNotFound) || !key)
goto __cleanup;
if (pubKey) {
SecKeyRef pkey = SecKeyCopyPublicKey(key);
*pubKey = ExtractPubKey(pkey);
CFRelease(pkey);
}
__cleanup:
if (key)
CFRelease((CFTypeRef)key);
return status;
}