Keychain Access uses a private API in
SecurityFoundation.framework to power the above dialog. I like the passwords it generates, but I wanted to use it from the terminal instead of launching Keychain Access every time I need a password.
Last summer I used Hopper Disassembler and
gdb to reverse engineer a few of the functions, which resulted in my tool sf-pwgen. Last month I dusted the code off a bit, and while doing so I added more function declarations.
You can find the header in my SecurityFoundation repository at