I have written a shell script that creates an encrypted sparsebundle disk image. I want to add a pubkey to the sparsebundle, but the option -pubkey (which is documented by Apple) is getting rejected when I add it to the shell script, or even when I just run a single line command in bash.
Am I missing something about this option? I read the documentation, but I still can't get it to work.
Currently the "create" line of the shell script looks like this (the script works fine as is, but when I add -pubkey it gives me a "usage" return):
echo $password | hdiutil create -size $space -encryption -type SPARSEBUNDLE -fs HFS+J $name
This is often cited as 'never working' or broken, but it can work & has done so for quite some time.
See below for an example, in short you just need to use Keychain Access to create a certificate for the public/private keys.
https://web.archive.org/web/20170106035834/http://design.caltech.edu/erik/Misc/encrypted_virtual_disk.html