I've imported a developer identity (certificate + private key) for iOS development to a keychain using the "security" Terminal application with the command
security import identity.p12 -k <keychain> -P <passphrase>
This imports both items included in the p12 file, certificate and private key, into the given keychain. I forgot to specify -T /usr/bin/codesign
, however, which adds the codesign application to the access list of the private key. I've tried to add the codesign app to the access list to no avail:
- I've tried to re-import the identity with the added parameter but that does not seem to change the access list of the private key.
- I've also tried deleting the certificate from the keychain using
security delete-certificate
and re-importing. This does not change the access list of the private key.
Since I only have ssh access to the machine, using the Keychain GUI application won't work. Therefore I'm looking for a way to delete the private key from the keychain (so that I can re-import the identity afterwards). I've checked the man page of the security
tool but did not find a means to delete a private key.
Is there any way you can remove a private key from a keychain using Terminal commands only (as I do only have ssh access to the machine in question)?
-T /usr/bin/codesign
flag during import. I've already tried the delete-certificate subcommand but it only deletes the certificate, not the private key. Therefore, the-T
flag is ignored upon a re-import since the private key is still contained in the keychain. Does this clarify the situation? – Rideout