How to use “SecItemAdd” to store a symmetric key in OS X?

拈花ヽ惹草 提交于 2019-12-01 23:20:22

What I am doing wrong? Any help would be highly appreciated.

It looks like kSecAttrKeyClassSymmetric is not supported. From a Google search of Apple source code (SecAttrKeyClassSymmetric site:opensource.apple.com), it looks like you get a NULL from SecKey.c:

case 2: // kSecAttrKeyClassSymmetric
    secwarning("Unsupported symmetric key type: %@", ktype);
    ref = NULL;
    break;
...

Base encode it and use kSecClassGenericPassword. Or, try stuffing it in the keychain without the encoding. An array is an array.

Keep in mind I could be reading those sources wrong. I don't read a lot of Apple source code (I try to avoid Apple).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!