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.