Keychain management command-line utility I'am trying to fully automate the process FileVault setup on multiple OS X user machines.
E.g. to have a Bash script as a result.
One of the steps is Institutional Recovery Key (IRK) generation. This key is required to access encrypted hard disk without user credentials.
The generation command sudo security create-filevaultmaster-keychain create a public-private key pair.
But only the public one must be installed on the user machine.
I can delete it using Keychain Access utility.
But this is a GUI utility and cannot be called from the Bash.
So, how can i remove the private key from the keychain-file from the command line?

Or maybe there are already working scripts for this task :)

P.S. I've already read this but find no answer:
IRK management
security command man
I haven't tried recovering data with it yet but I think the following works:

security create-filevaultmaster-keychain ~/Desktop/FileVaultMaster.keychain

security export -k ~/Desktop/FileVaultMaster.keychain -t certs -o ~/Desktop/FileVaultMasterPublic.cer

sudo fdesetup changerecovery -institutional -certificate ~/Desktop/FileVaultMasterPublic.cer


In my case FileVault was already enabled so I just added it after the fact.