static void Initialize()
        {
            if (Interlocked.CompareExchange(ref initialized, 1, 0) != 0)
            {
                return;
            }

            var handle = CFObject.dlopen(SecurityLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }

            try {
                ImportExportPassphase = CFObject.GetStringConstant(handle, "kSecImportExportPassphrase");
                ImportItemIdentity    = CFObject.GetStringConstant(handle, "kSecImportItemIdentity");
                MatchLimit            = CFObject.GetIntPtr(handle, "kSecMatchLimit");
                MatchLimitAll         = CFObject.GetIntPtr(handle, "kSecMatchLimitAll");
                MatchLimitOne         = CFObject.GetIntPtr(handle, "kSecMatchLimitOne");
                SecClassKey           = CFObject.GetIntPtr(handle, "kSecClass");
                SecClassIdentity      = CFObject.GetIntPtr(handle, "kSecClassIdentity");
                SecClassCertificate   = CFObject.GetIntPtr(handle, "kSecClassCertificate");
                ReturnRef             = CFObject.GetIntPtr(handle, "kSecReturnRef");
                MatchSearchList       = CFObject.GetIntPtr(handle, "kSecMatchSearchList");
            } finally {
                CFObject.dlclose(handle);
            }
        }
Exemplo n.º 2
0
        static SecIdentity()
        {
            var handle = CFObject.dlopen(AppleTlsContext.SecurityLibrary, 0);

            if (handle == IntPtr.Zero)
            {
                return;
            }

            try {
                ImportExportPassphase = CFObject.GetStringConstant(handle, "kSecImportExportPassphrase");
                ImportItemIdentity    = CFObject.GetStringConstant(handle, "kSecImportItemIdentity");
            } finally {
                CFObject.dlclose(handle);
            }
        }