Error with security export command

Hi,

I am encountering an issue with the security export command on my M1Pro. I want to export certificates + priv keys from the keychain, hence I run the following command:

security export -t identities \  
    -f pkcs12 \
    -P "exportPwd"

No matter the order of arguments and despite providing an export password, I get the following error message:

security: SecKeychainItemExport: Passphrase is required for import/export.

The commands works fine on an intel mac I have. I have found a message somewhere that hinted that could be a PATH issue which might be relevant, as the default PATH is different on intel vs aarch64. Also, I think the display error message is the wrong.

How can I get the command back to work ?
Thank for your help

Error with security export command
 
 
Q