Mount encrypted (password protected) volumes

Is there an API that allows mounting a volume, just like DADiskMount(), but that also accepts a password or automatically requests keychain access for encrypted volumes? Could be APFS or CoreStorage volumes. How do you mount those programmatically?

Replies

Hi,

No, I'm afraid there isn't an API that will do this, but the "diskutil" command line tool does handle this pretty well. I believe the basic "diskutil mount" command will automatically authenticate (going through the keychain and asking the user if necessary), but APFS (diskutil ap <command>) and CoreStorage (diskutil cs <command>) also have their own "unlockVolume" commands which provide more specific options/control. Note that diskutil commands also accept a "-plist" option to facilitate programmatic control.

-Kevin Elliott
DTS Engineer, CoreOS/Hardware