Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codesign returned unknown error -1=ffffffffffffffff

I tried to code sign an iOS application, These are the steps that i followed

    security create-keychain -p password ${KEYCHAIN}
    security set-keychain-settings -u -t 300 ${KEYCHAIN}
    security list-keychains -d user -s login.keychain ${KEYCHAIN}
    security import "$1" -k ${KEYCHAIN} -A -P "${PASSPHRASE}" -A >/dev/null
    security unlock-keychain -p password ${KEYCHAIN}

    /usr/bin/codesign -f -s $IDENTITY --keychain $KEYCHAIN --entitlements $ENTITLEMENTS Payload/Test.app

This returned me Codesign returned unknown error -1=ffffffffffffffff via ssh.

If i directly execute the code sign command in the machine, it's successfully signing.

The issue is only in Mac OS Sierra.

like image 427
Madhu Avinash Avatar asked May 25 '17 06:05

Madhu Avinash


4 Answers

Had the same problem a while ago, adding

security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password ${KEYCHAIN}

solved it for me.

like image 60
Gereon Avatar answered Oct 29 '22 06:10

Gereon


Got the same issue but while archiving directly from Xcode. Sharing the solution in case it helps.

Sometimes, Keychain seems to end up in a corrupted state. Using MacOS Sierra too.

Symptoms :

Relogin needed to access Accounts after restarting Xcode Relogin needed to access Accounts after restarting Xcode

Prompting for password while using Keychain Access for some operations Prompting for password while using Keychain Access for some operations

Keychain Access - Error while accessing login keychain via Change Settings for Keychain ... Keychain Access - Error while accessing login keychain via Change Settings for Keychain ...

What fixes it for me is locking and unlocking (password required) the involved Keychain, login in my case.

like image 31
Romano Avatar answered Oct 29 '22 06:10

Romano


I am going to chip in as well as I had to try a few more things than the ones mentioned here: the problem was that keychain doesn't like SSH sessions. I had to execute these in my session to fix it:

security unlock-keychain -p MY_PASS ~/Library/Keychains/login.keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k MY_PASS ~/Library/Keychains/login.keychain
security set-keychain-settings ~/Library/Keychains/login.keychain

I've also removed my current certificates system/account certificates by removing my account from XCode (I use fastlane to do building) but I suspect that this shouldn't have impacted it.

like image 6
Tadas Šubonis Avatar answered Oct 29 '22 05:10

Tadas Šubonis


@madhu I have been trying to fix the same issue and found that Access Control for the key associated with the certificate in question was set to "Confirm before allowing access" which didn't work in Jenkins. I modified it (thru Keychain Access gui - Get Info, Access Control) to "Allow all applications to access this item" and my build was successful.

like image 5
Simon H Avatar answered Oct 29 '22 05:10

Simon H