obscure-com / ti_keychain

iOS keychain wrapper for Appcelerator Titanium
78 stars 30 forks source link

Keychain issue #9

Open louis-quaintance opened 10 years ago

louis-quaintance commented 10 years ago

Hi there,

I'm testing with Titanium 3.4 and ios 8 and on the emulators I get this in the log?

error creating keychain item: -25299

[INFO] : 2014-10-26 21:44:55.435 COMPANYNAME [49764:230494] keychainItemData: {

[INFO] : acct = "";

[INFO] : desc = "";

[INFO] : gena = passwordKeychainItem;

[INFO] : icmt = "";

[INFO] : labl = "";

[INFO] : svce = "com.obscure.keychain";

[INFO] : "v_Data" = password;

[INFO] : }

Any ideas?

Thanks

sharpred commented 9 years ago

I am also seeing this, 25299 means duplicate entry. In KeychainItemWrapper.m, the function writeToKeychain has an if statement thus;

if (SecItemCopyMatching((CFDictionaryRef)genericPasswordQuery, (CFTypeRef *)&attributes) == noErr)

else ...

So it looks like your request is falling through the first part and trying to create a new keychain item, rather than update the existing one.

I am also seeing this on an old project I am upgrading to 3.4.1, iOS8. If I create a brand new project, with the same code, it works fine. Not sure why that is. Will update this when I have got somewhere

annakozy2011 commented 9 years ago

Any news on this? I am also experiencing the same error in version 2.1

Titanium 3.5.0

annakozy2011 commented 9 years ago

Take a look here please:

http://stackoverflow.com/questions/4309110/error-saving-in-the-keychain-with-iphone-sdk

annakozy2011 commented 9 years ago

I don't know that much of objective C and even less of keychain, but the problem is due to missing service value. It gets fixed if I add this line into keychainItemWrapperProxy.m, right after allocating keychainItem:

[keychainItem setObject:@"MYSERVICE" forKey:(id)kSecAttrService];

We can set service in some other way, but it's one option.

annakozy2011 commented 9 years ago

Also here there is a more complete explanation:

http://useyourloaf.com/blog/2010/04/28/keychain-duplicate-item-when-adding-password.html

gdenchev commented 8 years ago

Hi all,

I know a year has passed, but I am having the same problem and was wondering if there is any solution... I am using Titanium SDK 5.1.0, iOS SDK 8.4, keychain v2.1 I can see the same error: error creating keychain item: -25299 Looking through the code (and through the article from the last thread post), I think the problem may be caused by not setting the "account" property of the keychain item? Note: We had no problems in the past using SDK 3.2.3, iOS SDK 7.1, keychain v1.0

So, any thoughts or plans on updating this?