When i run this code from a command line xcode app on macos 10.12, i got the dialog box asking for permission.
CFArrayRef refs;
OSStatus status = SecTrustSettingsCopyCertificates(kSecTrustSettingsDomainUser, &refs);
SecCertificateRef ref = (SecCertificateRef)CFArrayGetValueAtIndex(refs, 1);
CFMutableDictionaryRef trustDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
SecPolicyRef policy = SecPolicyCreateBasicX509();
CFDictionaryAddValue(trustDict, kSecTrustSettingsPolicy, policy);
//now try to change the trust setting
status = SecTrustSettingsSetTrustSettings(ref, kSecTrustSettingsDomainUser, trustDict);
But the dialog box does not pop up when this is run from inside a Smartcard Extension.
Is it the limitation of a smartcard extension? That you are not allowed to modify trust settings of a certificate?
Michael