ios - Xamarin iOS 为 KeyChain 增加了值(value),设备上的所有应用程序都可以访问它

标签 ios xamarin xamarin.ios keychain

我为此创建了一个新问题,因为它与 Xamarin.当我偶然发现这个 question 时,我正在寻找一种在 iOS 中唯一标识设备的方法。在 StackOverflow 中。我花了一段时间才弄清楚如何将任何东西添加到钥匙串(keychain)中,我偶然发现了这个 question .

经过所有的磕磕绊绊,我想出了 this用于生成唯一 token 的一段代码。

var s = new SecRecord(SecKind.GenericPassword)
            {
                AccessGroup = "kSecAttrAccessGroupToken",
                ValueData = NSData.FromString(value),
                Generic = NSData.FromString(key)
            };
            SecKeyChain.Add(s);

现在的问题是,即使我将此条目添加到钥匙串(keychain)中,我也无法找到它。我也很想知道我是否正确使用了 kSecAttrAccessGroupToken。

我的 Enlistments.plist 文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>keychain-access-groups</key>
    <array>
        <string>my app id</string>
        <string>kSecAttrAccessGroupToken</string>
    </array>
</dict>
</plist>

最佳答案

kSecAttrAccessGroupToken is writable only by CryptoTokenKit smart card drivers. Apps can query the keychain using that attribute in order to find items stored on a particular smart card. This attribute is not for any other use.

10.3.x 测试版中存在一个错误,允许任何应用程序也可以向其写入数据,但该错误已被修复。

回复:https://forums.developer.apple.com/thread/72271

关于ios - Xamarin iOS 为 KeyChain 增加了值(value),设备上的所有应用程序都可以访问它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46396533/

相关文章:

ios - 从字典数组中获取最新日期的字典

ios - 类似 UITextView 的类,但具有处理 URL 点击的能力

c# - Microsoft Azure 移动服务 - Xamarin.Android 离线同步问题

ios - 错误二元运算符 '==' 不能应用于两个 'MKAnnotation' 操作数

ios - 使用未指定的索引。考虑添加 ".indexOn": "phone" at/use_frameworks_beta_2/searchIndex to your security rules for better performance

c# - Android:将变量设置为微调项供以后使用

xamarin - Mvvmcross:无法为绑定(bind) TextColor 创建目标绑定(bind)

ios - 如何在MonoTouch中使用CoreText编写旋转文本?

c# - MonoTouch 4.2 在设备上运行时不支持 System.ServiceModel.EndpointAddress()(在模拟器上运行)

ios - mvvmcross特定MvxViewController的ios锁定肖像方向