Search code examples
macoscocoakeychain

Keychain Services Secure Notes


The documentation for the Keychain Services API leaves a bit to be desired. One thing that I can't seem to locate are details on accessing the Secure Notes that the Keychain Access app lets you add and edit.

Any insight would be much appreciated. Thanks.


Solution

  • I figured out that you can pull the data using the security command line tool. Secure notes are stored as generic passwords with the following characteristics:

    class: "genp" - this is the same as a generic password

    type<uint32>="note" - you can use this to identify secure notes specifically when searching (using the -C flag).

    desc<blob>="secure note" - I don't know that you can search based on this field but it definitely identifies the item as a secure note

    0x00000007 <blob>= "Note name" - I don't know if you can get this via the API but you can definitely get it from the command line tool

    acct<blob>=<NULL> - This seems to be a common characteristic of secure notes

    Use the command security dump-keychain to find all kinds of useful info about the keychain items.