developer tip

ipa 파일에 다시 서명하는 방법은 무엇입니까?

copycodes 2020. 8. 17. 09:13
반응형

ipa 파일에 다시 서명하는 방법은 무엇입니까?


다른 프로비저닝 프로파일로 다음과 같은 IPA를 생성 한 후 프로비저닝 프로파일로 .ipa 파일에 어떻게 서명합니까? 베타 테스트를 위해 임시 프로비저닝 프로필로 IPA에 서명 한 다음 앱 스토어에 대한 앱 제출 프로비저닝 프로필로 정확한 IPA에 다시 서명하고 싶습니다.

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"

명령 줄에서하는 것은 정말 쉽습니다. 나는 이것을하기위한 대본의 요지를 가지고 있었다. 이제 매일 사용하는 https://github.com/RichardBronosky/ota-tools 의 ipa_sign 스크립트에 통합되었습니다 . 이러한 도구 사용에 대해 궁금한 점이 있으면 주저하지 말고 물어보십시오.

핵심은 다음과 같습니다.

IPA="/path/to/file.ipa"
PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in keychain
# unzip the ipa
unzip -q "$IPA"
# remove the signature
rm -rf Payload/*.app/_CodeSignature
# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision
# sign with the new certificate (--resource-rules has been deprecated OS X Yosemite (10.10), it can safely be removed)
/usr/bin/codesign -f -s "$CERTIFICATE" Payload/*.app
# zip it back up
zip -qr resigned.ipa Payload

새로 서명 된 앱은 resigned.ipa라고합니다.


이를 수행하는 방법에 대한 쉬운 도구는 iResign확인하십시오 !

약간의 혼란 끝에 키 체인 인식 사임에 대한 해결책을 찾았습니다. https://gist.github.com/Weptun/5406993 에서 확인할 수 있습니다.


오래된 질문이지만 최신 XCode를 사용 codesign하면 쉽습니다.

$ codesign -s my_certificate example.ipa 

$ codesign -vv example.ipa
example.ipa: valid on disk
example.ipa: satisfies its Designated Requirement

여기에 게시 된 답변은 모두 저에게 효과적이지 않았습니다. 그들은 주로 임베디드 프레임 워크 서명 (또는 인 타이틀먼트 포함)을 건너 뛰었습니다.

다음은 나를 위해 일한 것입니다 (현재 디렉토리에 하나의 ipa 파일이 있다고 가정합니다).

PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in the keychain

unzip -q *.ipa
rm -rf Payload/*.app/_CodeSignature/

# Replace embedded provisioning profile
cp "$PROVISION" Payload/*.app/embedded.mobileprovision

# Extract entitlements from app
codesign -d --entitlements :entitlements.plist Payload/*.app/

# Re-sign embedded frameworks
codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist Payload/*.app/Frameworks/*

# Re-sign the app (with entitlements)
codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist Payload/*.app/

zip -qr resigned.ipa Payload

# Cleanup
rm entitlements.plist
rm -r Payload/

Sierra iMac에 대한 Bryan의 코드를 업데이트했습니다.

# this version was tested OK vith macOs Sierra 10.12.5 (16F73) on oct 0th, 2017
# original ipa file must be store in current working directory 

IPA="ipa-filename.ipa"
PROVISION="path-to.mobileprovision"
CERTIFICATE="hexadecimal-certificate-identifier" # must be in keychain
# identifier maybe retrieved by running: security find-identity -v -p codesigning

# unzip the ipa
unzip -q "$IPA"

# remove the signature
rm -rf Payload/*.app/_CodeSignature

# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision

# generate entitlements for current app
cd Payload/
codesign -d --entitlements - *.app > entitlements.plist
cd ..
mv Payload/entitlements.plist entitlements.plist

# sign with the new certificate and entitlements
/usr/bin/codesign -f -s "$CERTIFICATE" '--entitlements' 'entitlements.plist'  Payload/*.app

# zip it back up
zip -qr resigned.ipa Payload

Fastlane의 한숨 은 IPA를 사임하는 데 상당히 강력한 솔루션을 제공합니다.

README에서 :

사임

ipa파일 을 생성 했지만 ipa 파일에 다른 코드 서명을 적용하려면 다음을 사용할 수 있습니다 sigh resign.

fastlane sigh resign

sigh will find the ipa file and the provisioning profile for you if they are located in the current folder.

You can pass more information using the command line:

fastlane sigh resign ./path/app.ipa --signing_identity "iPhone Distribution: Felix Krause" -p "my.mobileprovision"

It will even handle provisioning profiles for nested applications (eg. if you have watchkit apps)


  1. Unzip the .ipa file by changing its extension with .zip
  2. Go to Payload. You will find .app file
  3. Right click the .app file and click Show package contents
  4. Delete the _CodeSigned folder
  5. Replace the embedded.mobileprovision file with the new provision profile
  6. Go to KeyChain Access and make sure the certificate associated with the provisional profile is present
  7. Execute the below mentioned command: /usr/bin/codesign -f -s "iPhone Distribution: Certificate Name" --resource-rules "Payload/Application.app/ResourceRules.plist" "Payload/Application.app"

  8. Now zip the Payload folder again and change the .zip extension with .ipa

Hope this helpful.

For reference follow below mentioned link: http://www.modelmetrics.com/tomgersic/codesign-re-signing-an-ipa-between-apple-accounts/


Try this app http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload/

It supposed to help you resign the IPA file. I tried it myself but couldn't get pass an error with Entitlements.plist. Could just be a problem with my project. You should give it a try.


You should try this new OSX app : AirSign.

This will help you to resign your IPA and share it directly over-the-air with your beta testers. If you choose to re-sign it manually, especially if you modify the Bundle Id of the app, you should really be carefull with the app's entitlements (In some case, it could be complicated...).

Regards,

Romain

참고URL : https://stackoverflow.com/questions/5160863/how-to-re-sign-the-ipa-file

반응형