Xamarin iOS为KeyChain增值,设备上的所有应用均可访问 [英] Xamarin iOS add value to KeyChain which can be accessed by all apps on device

查看:78
本文介绍了Xamarin iOS为KeyChain增值,设备上的所有应用均可访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为此创建了一个新问题,因为它与Xamarin的链接更多.当我偶然发现此问题在StackOverflow中.我花了一段时间才弄清楚如何在钥匙串中添加任何东西,他们偶然发现了这个

I've created a new question for this since this is more linked to Xamarin. I was looking for a way to uniquely identify a device in iOS when I stumbled upon this question in StackOverflow. It took me a while to figure out how to add anything into Keychain and them I stumbled upon this question.

经过种种绊脚石,我想到了代码段,用于生成唯一的代码令牌.

After all the stumbling, I came up with this piece of code for generating the unique token.

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

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

Now the problem is that even though I'm adding this entry to keychain I am unable to find it. I'm also interested to know if I am using the kSecAttrAccessGroupToken correctly.

我的Enlistments.plist文件

My Enlistments.plist file

<?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仅可由CryptoTokenKit智能卡驱动程序写入.应用程序可以使用该属性查询钥匙串,以查找存储在特定智能卡上的物品.此属性不可用于任何其他用途.

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 Beta中存在一个错误,该错误允许任何应用程序也可以对其进行写入,但已对其进行了修补.

There was a bug in 10.3.x beta that would allow any app to also write to it, but that has been patched.

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

这篇关于Xamarin iOS为KeyChain增值,设备上的所有应用均可访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆