I have been trying to import a certificate on MacOS (Monterey).
I managed to convert my key.pem and cert.pem to a .pfx and added it on a Windows machine, and signed a binary using windows's signtool with the pfx file.
When trying something similar on MacOS, it complains that it is the wrong password (and cancel after 3 "failed" attempts).
openssl pkcs12 -export -clcerts -inkey key.pem -in cert.pem -out cert_p12.p12
sudo security import macos_p12.p12 -A -k "/Library/Keychains/System.keychain"
I also tried to generate my own certificate, where I simply just set the password to 1234, and add that, but that also failed with the samme password error:
openssl req -x509 -newkey rsa:4096 -keyout macos_key.pem -out macos_cert.pem -sha256 -days 365
openssl pkcs12 -export -clcerts -inkey macos_key.pem -in macos_cert.pem -out macos_p12.p12
sudo security import macos_p12.p12 -A -k "/Library/Keychains/System.keychain"
So I don't know what I am doing wrong, so I would appriciate any help!