MAC verification failed during PKCS12 import (wrong password?) / Azure Devops

Viewed 2784

I'm using the InstallAppleCertificate@2 task from Azure DevOps but each time I try running it this error pops up

security: SecKeychainItemImport: MAC verification failed during PKCS12 import (wrong password?)

this is the task I'm using

- task: InstallAppleCertificate@2
inputs:
  certSecureFile: "${{ parameters.certificateSecureFileName }}"
  certPwd: "${{ parameters.certificatePassword }}"
displayName: "Install AdHoc Certificate"

I'm pretty sure the password is correct since I tried the same command locally and it worked. Password doesn't contain any special characters and is being stored in a variables group.

Any help would be appreciated. Thank you

1 Answers

OpenSSL 3.x changed its default algorithm in pkcs12. Which is not compatible with embedded Security frameworks in macOS/iOS. You could alternatively use OpenSSL 1.x.

See:

To macOS users: If you're using openssl@3 command line tool installed via Homebrew, downgrade to openssl@1.1 and modify your PATH in ~/.zshrc. For example:

export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"
export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"

If you're using openssl@3 libraries (libcrypto and libssl) with SecKeychainItemImport or SecPKCS12Import, have a look at the commit page above and do some modifications to your codes.

Related