1

I am attempting to import a PFX/P12 certificate generated by the Windows certificate manager for use with S/MIME into MacOS Catalina Keychain. The certificate is encrypted with AES256.

The same certificate and password work correctly when encrypted with 3DES.

When the certificated uses AES256, Keychain complains "MAC verification failed during PKCS12 import" after I enter the password. The same error is achieved using the security cli.

Any ideas what might be wrong?

CLI examples that did not work:

security import ./foo.pfx -f pkcs12
security import ./foo.pfx -t cert -f pkcs12
security import ./foo.pfx -f pkcs12 -k ~/Library/Keychains/login.keychain
security import ./foo.pfx -f pkcs12 -T /usr/bin/codesign -k ~/Library/Keychains/login.keychain

Update 1: How the Certificates were Created

  1. Login with my user on a Windows 10 desktop
  2. Open Manager User Certificates
  3. Personal -> Certificates -> All Tasks -> Request New Certificate
  4. Select the appropriate enrollment policy
  5. Right click the certificate and choose "Export..."
  6. Select the format:
    1. PFX
      1. include all certificates
      2. enable certificate privacy
  7. Set the password
  8. Finish

At some point in the process I chose AES256 or 3DES from a drop down (only two options available)

2
  • How exactly did you create the problem certificate, and how exactly did you export it?
    – not2savvy
    Apr 29, 2020 at 14:30
  • Sorry, I hadn't been noticed that you've updated your question. How long is the password you protect the export file with? I've experienced problems with importing PKCS#12 files with long passwords. (I don't remember the exact limit, maybe around 20 chars.)
    – not2savvy
    May 29, 2020 at 14:45

1 Answer 1

0

Alternatively you can use Internet Explorer to re-export the file into a Triple DES format that the Mac accepts.

  • Import the certificate into a Windows system by simply double clicking the pfx or p12 file.
  • During import, tick the option to mark the private key as exportable and accept all other defaults.
  • Open Internet explorer and go to "Tools → Internet Options", choose the content tab and click on Certificates.
  • Find and highlight the certificate imported and click on Export.
  • During the export, choose to export the private key as well and accept all other defaults, save the certificate to disk as a pfx file.
  • Import the newly generated pfx certificate.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .