3

I am using Saving SecKeyRef device generated public/private key pair on disk this example, however im keep getting -25300 in sanityCheck.Could anyone please tell me what went wrong or what does this error means ? Mant thanks

SecKeyRef publicKey; SecKeyRef privateKey;

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.
Community
  • 1
  • 1
Max
  • 35
  • 5

0 Answers0