"Unknown Error = -2,147,414,007" on creating certificate with Certificate Assistant
Was able to get this to work. The purpose for creating a certificate was to codesign gdb on Mac. Here are the steps for the same:-


Create a certificate with all the parameters mentioned above.
Instead of saving the Keychain under location System, save it under
Login. 
Then, unlock the System Keychain by clicking on the lock icon
on the top left corner and drag the certificate from Login to System.
Right Click the Certificate, click on Get Info and and under Trust, set to Always Trust.
Restart taskgated in terminal: killall taskgated
Enable root account:
Open System Preferences.
Go to User &amp; Groups > Unlock.
Login Options > "Join" (next to Network Account Server).
Click "Open Directory Utility".
Go up to Edit > Enable Root User.
Run codesign -fs gdbc /usr/local/bin/gdb in the terminal.
Disable Root Account again and you should be good to go.


Credits:


Keychain Access error when creating new system certificate
https://gist.github.com/hlissner/898b7dfc0a3b63824a70e15cd0180154