Hello. I want to do the following and need your help.
- I want to import a certificate (pkcs#12) into my macOS keychain with a setting that prohibits exporting the certificate.
- I want to import the certificate (pkcs#12) into my login keychain or system keychain.
I was able to achieve [1] with the help of the following threads, but have the following problems.
https://developer.apple.com/forums/thread/677314?answerId=824644022#824644022
- how to import into login keychain or system keychain
- How to achieve this without using the deprecated API
To import into the login keychain, I could use the “SecKeychainCopyDefault” function instead of the “SecKeychainCopySearchList” function, However, both of these functions were deprecated APIs.
https://developer.apple.com/documentation/security/seckeychaincopysearchlist(_:)
https://developer.apple.com/documentation/security/seckeychaincopydefault(_:)
I checked the following URL and it seems that using the SecItem API is correct, but I could not figure out how to use it.
https://developer.apple.com/documentation/technotes/tn3137-on-mac-keychains
Is there any way to import them into the login keychain or system keychain without using these deprecated APIs?