I recently wanted to move my developer certificates from one mac to another (via Xcode - Preferences - Account - Manage Certificates - Export Developer ID Application Certificates), but after importing the .p12 file on the second mac, I constantly got the error message

1
2
Warning: unable to build chain to self-signed root for signer "Developer ID Application: xxxxx (yyyy)"
my.app: errSecInternalComponent

After searching for an answer in the net, I found out that when you only import such a Developer ID Application Certificate (without logging into your developer account inside Xcode), the system is missing a certificate from Apple itself.

If you face the same error, just head over to https://www.apple.com/certificateauthority/, download and install the Developer ID - G2 (Expiring 09/17/2031 00:00:00 UTC) certificate - and voilà, signing works as expected.