我正在使用在磁盘上保存 SecKeyRef 设备生成的公钥/私钥对这个例子,但是我在 sanityCheck 中不断得到 -25300。谁能告诉我出了什么问题或这个错误意味着什么?谢谢
SecKeyRef 公钥;SecKeyRef 私有密钥;
CFDictionaryRef keyDefinitions;
CFTypeRef keys[2];
CFTypeRef values[2];
keys[0] = kSecAttrKeyType;
values[0] = kSecAttrKeyTypeRSA;
keys[1] = kSecAttrKeySizeInBits;
int iByteSize = 2048;
values[1] = CFNumberCreate(NULL, kCFNumberIntType, &iByteSize);
keyDefinitions = CFDictionaryCreate(NULL, keys, values, sizeof(keys) / sizeof(keys[0]), NULL,NULL );
OSStatus status = SecKeyGeneratePair(keyDefinitions,&publicKey, &privateKey);
status = SecItemCopyMatching((CFDictionaryRef)publicKey, (CFTypeRef *)&publicKeyBits);//<--where error occur.