openssl pkcs12 -in <certificate_name>.p12 -nodes -nocerts | openssl rsa -out cert_key
    

    Or you can create a new private key by executing the following command:

    
ssh-keygen -t rsa -b 2048 -m PEM -f cert_key -q -N ""
    

    Later, you can have CLI tools automatically create a new iOS Distribution from the private key.

Set up a new temporary keychain to be used for code signing:

    
keychain initialize
    

    
      Restore Login Keychain!
After running keychain initialize you must run the following:

      keychain use-login

      This sets your login keychain as the default to avoid potential
authentication issues with apps on your machine.

Fetch the code signing files from App Store Connect: