After upgrading to macOS 10.12 Sierra and Xcode 8, code signing is broken for me.
Every time I try to sign an app, no matter how simple, I get /usr/bin/codesign failed with exit code 11
.
Turns out the reason was that I had to delete expired certificates from Keychain.
Hope I saved you a few minutes of aimless, frustrated troubleshooting.