3

この例では、SecKeyRef デバイスで生成された公開鍵と秘密鍵のペアをディスクに保存していますが、sanityCheck で -25300 を取得し続けています。マントありがとう

SecKeyRef publicKey; 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.
4

0 に答える 0