Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any length limit of string stored in Keychain?

I want to store some userinfo as a string in Keychain on iOS, so is there any length limit of the string in Keychain?

Thanks.

like image 572
fannheyward Avatar asked Nov 21 '12 08:11

fannheyward


People also ask

What is the best way to securely share the secret credentials among a family of apps in the device?

If you develop a family of apps, all of which rely on the same user secret, you can use access groups to securely share that secret among those apps. For example, you can share credentials, so that logging into one of your apps automatically grants the user access to all of your apps.

How do I turn on keychain sharing in IOS?

In Xcode, go to Project settings > Capabilities. Enable Keychain Sharing. Add a keychain group identifier. Use the same identifier for all of the apps you want to share state.

What is keychain IOS?

iCloud Keychain remembers things, so that you don't have to. It autofills your information—like your Safari and app usernames and passwords, passkeys, credit card information and security codes, and Wi-Fi passwords on any device that you approve.


2 Answers

I threw together an iOS app that would do a binary search using this library to interact with the keychain, and determined that the most I could store was an NS(Mutable)String with length 16,777,110. So noticeably less than either the max length of an NSString or the default value of SQLITE_MAX_LENGTH as suggested in other answers.

EDIT: If you're looking to quickly verify this answer, I'd suggest trying to store a String with length 16,777,110 in the keychain, and then trying one with length 16,777,111. If the first one works and the second one doesn't, this answer is correct.

like image 155
Mark Avatar answered Sep 30 '22 19:09

Mark


It's hard to answer :) It should support the maximum length of NSString

So the Keychain string can hold a little over 4.2 billion characters same as NSString

like image 23
Shamsudheen TK Avatar answered Sep 30 '22 20:09

Shamsudheen TK