IPhone4 SecItemCopyMatching returns -25300 after reboot

My method:

+(SecKeyRef)getKeyByTagWithoutAlert:(NSString *)keyTag status:(OSStatus *) status{
    *status = noErr;
    SecKeyRef key = NULL;

    NSMutableDictionary *queryKey = [[NSMutableDictionary alloc] init];

    // Set the key query dictionary.
    [queryKey setObject:(id)kSecClassKey forKey:(id)kSecClass];
    [queryKey setObject:[SecKeyUtility getDataByTag:keyTag] forKey:(id)kSecAttrApplicationTag];
    [queryKey setObject:(id)kSecAttrKeyTypeRSA forKey:(id)kSecAttrKeyType];
    [queryKey setObject:[NSNumber numberWithBool:YES] forKey:(id)kSecReturnRef];

    *status = SecItemCopyMatching((CFDictionaryRef)queryKey, (CFTypeRef *)&key);

    [queryKey release];
    return key;
}

      

And it works great until I restart my iPhone4. After that, SecItemCopyMatching returns error code -25300 and my application stops correctly. On iPhone3 I don't have this problem, just work perfect. Can you help me?

Sorry for my English.

+2


source to share


1 answer


The error 25300

is equal errSecItemNotFound

, which means there is no such item in your keychain.



+3


source







All Articles