酢ろぐ!

カレーが嫌いなスマートフォンアプリプログラマのブログ。

ipaファイルに組み込まれているembedded.mobileprovisionの中身を調べる

大昔に「Xcodeでのビルドを自動化するxcodebuildコマンドとIPAファイルを作成してiTunes Connect(Testflight)に投げる方法 - 酢ろぐ!」で書いたように、Jenkinsからxcodebuildを叩いてipaを作成しています。つい最近AdHocビルドで生成したipaファイルに含まれている provisioning proflie (.mobileprovisionファイル)の情報を読みたいと言われました。

ipaファイルからprovisioning proflieを取り出す

ipaファイルからprovisioning proflieを取り出す方法としては以下の通りです。

  1. ipaファイルの拡張子を.zipに変更する
  2. 展開する
  3. embedded.mobileprovisionを探す

ipaファイルに組み込まれているembedded.mobileprovisionの中身を調べる

署名に使われたembedded.mobileprovisionの中身を表示させるためにはsecurityコマンドを利用します。

mkdir APP_NAME.ipa.tmp 
cd /Users/ch3cooh/Desktop/APP_NAME.ipa.tmp 
unzip /Users/ch3cooh/Desktop/APP_NAME.ipa
cd ./Payload/APP_NAME.app
security cms -D -i embedded.mobileprovision

以下のようなplistを表示させることができます。出力をファイルにすればplistとして表示させることも可能です。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AppIDName</key>
    <string>Common</string>
    <key>ApplicationIdentifierPrefix</key>
    <array>
    <string>TEAM_ID</string>
    </array>
    <key>CreationDate</key>
    <date>2017-09-29T14:45:05Z</date>
    <key>Platform</key>
    <array>
        <string>iOS</string>
    </array>
    <key>DeveloperCertificates</key>
    <array>
        <data></data>
        <data></data>
        <data></data>
    </array>
    <key>Entitlements</key>
    <dict>
        <key>keychain-access-groups</key>
        <array>
            <string>TEAM_ID.*</string>        
        </array>
        <key>get-task-allow</key>
        <false/>
        <key>application-identifier</key>
        <string>TEAM_ID.*</string>
        <key>com.apple.developer.team-identifier</key>
        <string>TEAM_ID</string>
    </dict>
    <key>ExpirationDate</key>
    <date>2018-09-28T00:15:17Z</date>
    <key>Name</key>
    <string>iOS Team Ad Hoc Provisioning Profile: *</string>
    <key>ProvisionedDevices</key>
    <array>
        <string>device_id</string>
        <string>device_id</string>
        <string>device_id</string>
        <string>device_id</string>
    </array>
    <key>TeamIdentifier</key>
    <array>
        <string>TEAM_ID</string>
    </array>
    <key>TeamName</key>
    <string>jp.ch3cooh</string>
    <key>TimeToLive</key>
    <integer>363</integer>
    <key>UUID</key>
    <string>xxxx-xxxx-xxxx-xxxx-xxxx</string>
    <key>Version</key>
    <integer>1</integer>
</dict>
</plist>