We're hitting against this same issue, except we're not trying to do it from an application, we're just trying to script the setup of a CI environment.
We need to add the cert, and we only have SSH terminal access, no GUI, so the add cert command hangs while it waits for the GUI password prompt that we cannot access. This is broken. As CameronP stated, no command line tool should require a GUI, that's insane.
Where do we go from here?