keychain

Keychain: Item reported as errSecItemNotFound, but receive errSecDuplicateItem on addition

别来无恙 提交于 2019-11-27 13:31:12
问题 This issue has been bugging me for a while, and I hope someone has insight as to the cause of this. Essentially, I have a small percentage of users who are unable to save/update items to the keychain. The problematic flow of control is as follows: We check for the existence of the item using SecItemCopyMatching . This returns the error code errSecItemNotFound We then try to add the item via SecItemAdd , but this then returns errSecDuplicateItem . Because of this, we have some users who are

iOS KeychainItemWrapper not updating

时间秒杀一切 提交于 2019-11-27 13:12:30
问题 I just found an interesting problem with my app. In the app I am saving the user's user name and password to the keychain. keychainWrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"MyLoginPassword" accessGroup:nil]; [keychainWrapper setObject:usernameField.text forKey:(id)kSecAttrAccount]; [keychainWrapper setObject:passwordField.text forKey:(id)kSecValueData]; When this code is run in Debug it seems to work just fine. It updates each time and I can later retrieve the items from the

SFHFKeychainUtils. iOS keychain. ARC compatible

六月ゝ 毕业季﹏ 提交于 2019-11-27 12:52:08
I was wondering if anyone that was using the SFHFKeychainUtils managed to modify them to be compatible for ARC. More exactly the NSDictionary *attributeResult = NULL; NSMutableDictionary *attributeQuery = [query mutableCopy]; [attributeQuery setObject: (id) kCFBooleanTrue forKey:(__bridge id) kSecReturnAttributes]; OSStatus status = SecItemCopyMatching((CFDictionaryRef) attributeQuery,(CFTypeRef *)(attributeResult)); I tried OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef) attributeQuery,(CFTypeRef *)(attributeResult)); also CFTypeRef subAttributeResult = (CFTypeRef *)(objc

Obtaining admin privileges to delete files using rm from a Cocoa app

末鹿安然 提交于 2019-11-27 12:30:51
问题 I am making a small app that deletes log files. I am using an NSTask instance which runs rm and srm (secure rm) to delete files. I want to be able to delete files in: /Library/Logs ~/Library/Logs The issue is that the user account does not have permissions to access some files in the system library folder, such as the Adobe logs subfolder and others. For example, only the "system" user (group?) has r/w permissions for the Adobe logs folder and its contents, and the current user doesn't even

Save and retrieve value via KeyChain

一曲冷凌霜 提交于 2019-11-27 11:51:22
I'm trying to store an Integer and retrieve it using KeyChain. This is how I save it: func SaveNumberOfImagesTaken() { let key = "IMAGE_TAKEN" var taken = 10 let data = NSKeyedArchiver.archivedDataWithRootObject(taken) let query : [String:AnyObject] = [ kSecClass as String : kSecClassGenericPassword, kSecAttrAccount as String : key, kSecValueData as String : data ] let status : OSStatus = SecItemAdd(query as CFDictionaryRef, nil) } This is how I try to retrieve it: func CheckIfKeyChainValueExitss() -> AnyObject? { var key = "IMAGE_TAKEN" let query : [String:AnyObject] = [ kSecClass as String :

iOS Keychain writing value results in error code -34018

馋奶兔 提交于 2019-11-27 11:36:53
问题 I have an iOS application that stores some sensitive information in the keychain. While writing values into the keychain, I am getting error code -34018. I am currently using Apple's iOS KeyChainItemWrapper class. Both of the following lines of code receive the same error code. OSStatus res1 = SecItemCopyMatching((__bridge CFDictionaryRef)genericPasswordQuery, (CFTypeRef *)&attributes); OSStatus res = SecItemUpdate((__bridge CFDictionaryRef)updateItem, (__bridge CFDictionaryRef)tempCheck);

RSA Encryption-Decryption in iphone

[亡魂溺海] 提交于 2019-11-27 11:23:44
I am developing Iphone application. I have used SecKeyGeneratePair method of Security/Security.h framework. I am getting public & private keys as SecKeyRef objects. Can I access the key or print its value to console? Can I get NSString or NSData object from it ? When i print the key to console using NSLog I am getting . Can we pass these key objects over network to other application which might be in java? Can we encrypt some text in iphone application, send it to server, using the key sent decrypt the text on server side ? Edited to add Thanks Alex Reynolds for your quick response. In case of

Xcode won't let to build for Device after denying Codesign to access Keychain

混江龙づ霸主 提交于 2019-11-27 11:14:33
I'm new to iOS development and today I tried to check my app on my iPhone and tried to build it for the device. So when I clicked on build, it asked to type my password to let codesign to access keychain. But after few attempts, I accidentally clicked on deny button. Then after again I tried to build my app for the device and now it says, Swift sodlib tool error, task failed with exit 1 signal 0 And when I check that error it says, unknown error -1=ffffffffffffffff error: Task failed with exit 1 signal 0 { /usr/bin/codesign '--force' '--sign' 'A6646CD79C82476C1C35598A10134D3171EE09CD' '-

Storing authentication tokens on iOS - NSUserDefaults vs Keychain?

眉间皱痕 提交于 2019-11-27 11:00:31
Which is the place I should be storing tokens for when the user logins in to a service? I'm not saving passwords (obviously where I'd use the Keychain) but just the token. A lot of places say just use NSUserDefaults but some people on StackOverflow seem really keen on the Keychain. Is NSUserDefaults fine? lxt I would highly recommend you use the keychain - it's exactly what Facebook do for storing their session tokens. NSUserDefaults is not secure or encrypted - it can be easily opened and read, both on device and when synced to a Mac. So whilst user defaults is a good place for things like

Getting “A valid signing identity matching this profile could not be found in your keychain” warning

只愿长相守 提交于 2019-11-27 10:16:41
I hope to test my app on iPod Touch I created development provisioning profile. I dragged downloaded .mobileprovision file to Organizer There is a yellow triangle warned that "A valid signing identity matching this profile could not be found in your keychain" The others distribution provisioning profiles have no any problem. I checked my connected iPod Touch. Organizer also said that: OS Installed on "interdev"'s iPod 3.1.3 (7E18) Xcode Supported iPhone OS Versions 3.1.1 (7C146) 3.1.1 (7C145) 3.1 (7C144) 3.0.1 (7A400) 3.0 2.2.1 2.2 2.1.1 2.1 2.0.2 (5C1) 2.0.1 (5B108) 2.0 (5A347) 2.0 (5A345)