How does keychain restore work in other idevice? app A stores passwords in keychain programmatically. One password is stored in one keychain item. Keychain item is a class of type Generic Password. app A is installed &amp; used in idevice1 &amp; idevice2 (ios4.0 &amp; later). Now take the encrypted backup of device1 and restore it in device2.

Does it overwrite the keychain items of same match in device2 or stores the keychain items from backup alone?
When you restore an iOS backup - all the previous contents are gone so there is no merging of old and new contents. You end up with the current keychain matching the backed up keychain.

The only subtle aspect is that if you do not have a passcode lock on the device, some items stored in the keychain are wiped (either not backed up or not restored - it's not clear when this happens). This ensures that you actually have to re-enter mail passwords and such.

This protects from someone restoring your backup without your knowledge and then being able to read your email. They either need to know your passcode or your password to make use of a restored keychain and app settings on a new device initially after restore.