How much content can be stored in the iOS Keychain (per record, and per app)?

Hi all,


I was wondering whether there are documented (or known) hard limits for the amount of content pushed into Keychain on iOS, per record and per app.


Thanks again.

Replies

>How much content can be stored in the iOS Keychain


Before what? How much do you have?


According to the docs, "a keychain can hold any number of items..." Presumably the limit then is space on storage.


See 'Structure of a keychain' https://developer.apple.com/library/content/documentation/Security/Conceptual/keychainServConcepts/02concepts/concepts.html

SQLite has a SQLITE_MAX_LENGTH of 1 billion by default for bytes in a String or Blob.


"The maximum number of bytes in a string or BLOB in SQLite is defined by the preprocessor macro SQLITE_MAX_LENGTH. The default value of this macro is 1 billion (1 thousand million or 1,000,000,000)."


https://www.sqlite.org/limits.html#max_length


Does anyone know whether Keychain has a different value? Do any Apple engineers monitor the forums?


Thanks again

A related discussion came up on Valet, a popular third-party Keychain library put out by Square.

Apparently, 4KB is the "soft limit" and 16MB is the only known hard limit.

Anything in-between risks a keychain error due to the system killing securityd.

https://github.com/square/Valet/issues/246