macos - 将项目添加到除默认值之外的特定 OS X 钥匙串(keychain)

标签 macos cocoa keychain

我正在开发一个 macOS 应用程序。我正在创建自己的钥匙串(keychain)。钥匙串(keychain)文件存储在磁盘上的特定位置。每次启动应用程序时,我都必须从此钥匙串(keychain)写入和读取数据。

我无法找到将项目添加到此特定钥匙串(keychain)的正确方法。我正在使用SecItemAdd() 。我想指定 SecItemAdd() 应将项目添加到哪个钥匙串(keychain)。

最佳答案

您尝试过SecKeychainSetDefault吗?来自 description :

In most cases, your application should not need to set the default keychain, because this is a choice normally made by the user. You may call this function to change where a password or other keychain items are added, but since this is a user choice, you should set the default keychain back to the user specified keychain when you are done.

当然,您将需要其他调用来获取此调用所需的 SecKeychainRef 参数等,例如SecKeychainOpenSecKeychainCopyDefault

HTH

关于macos - 将项目添加到除默认值之外的特定 OS X 钥匙串(keychain),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44307298/

相关文章:

android - 如何在android中的两个或多个应用程序之间安全地共享数据?

macos - 为什么 Emacs 在尝试最大化框架时会留下空白?

python - 使用 macOs Sierra 安装 pyaudio

macos - 如何使 Mac 终端提示符和命令加粗?

cocoa - 解包多个 Swift 可选值

objective-c - NSFileManager - 使用空格?

macos - 在 OS X 上使用 X509Certificate2 时避免使用钥匙串(keychain)

android - 从 cli OS X (10.7.3) 启动 ddms 时出现错误 : "Failed to get the adb version...."

Cocoa 到 GEDCOM 文件的接口(interface)

xamarin.forms - Xamarin使用用户证书形成android