mac下查看.mobileprovision檔案及鑰匙串中認證.cer檔案,mobileprovisioncer
mac下查看.mobileprovision檔案及鑰匙串中認證.cer檔案一. mobileprovision檔案查看
xxx.mobileprovision是ios開發中的裝置描述檔案,裡面有認證資訊、調試裝置的UUID資訊、bundle identifier等,此檔案是二進位格式不能直接開啟,那麼如何查看其中資訊呢
方法1 使用mac內建security命令列
用mac內建的命令security,cd到mobileprovision所在的檔案夾,執行
security cms -D -i XXX.mobileprovision
會得到下面的dict結構的詳細資料
<?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>xxxx</string> <key>ApplicationIdentifierPrefix</key> <array> <string>xxxx</string> </array> <key>CreationDate</key> <date>2016-10-31T04:06:14Z</date> <key>Platform</key> <array> <string>iOS</string> </array> <key>DeveloperCertificates</key> <array> <data>MIIFkDCCBHigxxxxxxxxxxxxxxxxxxWnPvqA5L3daJ1NY43ZXn5t6oGiAMwmrf8tXE/qgUpR+JH3+BENoD2y/DiQBTOzyb/LBC/KwNrdR5J95xsg9O3x5hEP8A0c</data> </array> <key>Entitlements</key> <dict> <key>com.apple.developer.pass-type-identifiers</key> <array> <string>xxxxx.*</string> </array> <key>keychain-access-groups</key> <array> <string>xxxxx.*</string> </array> <key>inter-app-audio</key> <true/> <key>get-task-allow</key> <true/> <key>application-identifier</key> <string>8YBR4R554P.com.playcrab.heracles.dev</string> <key>com.apple.developer.healthkit</key> <true/> <key>com.apple.developer.ubiquity-kvstore-identifier</key> <string>8YBR4R554P.*</string> <key>com.apple.developer.ubiquity-container-identifiers</key> <array> <string>8YBR4R554P.*</string> </array> <key>com.apple.developer.associated-domains</key> <string>*</string> <key>com.apple.security.application-groups</key> <array> </array> <key>com.apple.developer.homekit</key> <true/> <key>com.apple.developer.team-identifier</key> <string>8YBR4R554P</string> <key>com.apple.external-accessory.wireless-configuration</key> <true/> <key>aps-environment</key> <string>development</string> <key>com.apple.developer.in-app-payments</key> <array> </array> <key>com.apple.developer.default-data-protection</key> <string>NSFileProtectionComplete</string> <key>com.apple.developer.networking.vpn.api</key> <array> <string>allow-vpn</string> </array> <key>com.apple.developer.siri</key> <true/> </dict> <key>ExpirationDate</key> <date>2017-10-31T04:06:14Z</date> <key>Name</key> <string>xxxx</string> <key>ProvisionedDevices</key> <array> <string>70daba5aefxxxxxb5cf04ec73a385d970</string> <string>d8c16f16ef33xxxxxx3aad0xxxa382a9e2</string> </array> <key>TeamIdentifier</key> <array> <string>8YBRxxxx54P</string> </array> <key>TeamName</key> <string>Nxxxx</string> <key>TimeToLive</key> <integer>365</integer> <key>UUID</key> <string>1c38459f-7xxxxxe286351</string> <key>Version</key> <integer>1</integer></dict>
方案2 mobileprovision-read命令來實現
在Terminal下輸入下面的命令並斷行符號
curl https://raw.githubusercontent.com/0xc010d/mobileprovision-read/master/main.m | clang -framework Foundation -framework Security -o /usr/local/bin/mobileprovision-read -x objective-c -
這條命令的作用是下載mobileprovision-read的源碼,然後編譯,最後把產生的二進位檔案mobileprovision-read
放入到/usr/local/bin/
路徑下。
執行下面命令後,可以得到與上面dict展示一樣的資訊
mobileprovision-read -f xxx.mobileprovision
二. 鑰匙串中認證.cer檔案查看
鑰匙串訪問(keychain access.app)中斷各種認證,如何查看他們的公開金鑰和私密金鑰資訊呢,比如如下認證中的公私密金鑰資訊呢
需要右鍵將其匯出成.p12檔案,之後將.p12檔案轉成.pem檔案,轉成.pem的方法使用下面的命令
openssl pkcs12 -in xxx.p12 -out xxx.pem -nodes
之後用記事本開啟xxx.pem檔案,就能讀到公開金鑰私密金鑰了
Bag Attributes friendlyName: iPhone Developer: Ning Liu (3Q73CFK5RP) localKeyID: F0 BF 58 9E FD 88 7D 61 7E 41 2B 0F 5B F2 03 C5 1F BC 0D 16 subject=/UID=RNG8K5DALX/CN=iPhone Developer: Ning Liu (3Q73CFK5RP)/OU=8YBR4R554P/O=Ning Liu/C=USissuer=/C=US/O=Apple Inc./OU=Apple Worldwide Developer Relations/CN=Apple Worldwide Developer Relations Certification Authority-----BEGIN CERTIFICATE-----MIIFkDCCBHigAwIBAgIIasmZb9B0IcUwDQYJKoZIhvcNAQELBQAwgIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtXnbnM/N12EGccq7oH5WPQSOrcte5NxVFTdhT1mY7i4/7/Hf3N4n2gpjUUtykg8H4jDQERpZHSbQYyHpcdiH6f9EsSXM+bA1a5yEpPL0zUJJSgCXR-----END CERTIFICATE-----Bag Attributes friendlyName: guan localKeyID: F0 BF 58 9E FD 88 7D 61 7E 41 2B 0F 5B F2 03 C5 1F BC 0D 16 Key Attributes: <No Attributes>-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAvz/81SxGFOHWOlR6kC4vi+UO8o/4QW9vx7wu54utXb22hh9PXbNv81+NQUo+e1BRr5h6ueDPUQFunBscQ10CNQp6CEHgTntYXMT2P9a9+2mLCLZxGpKSbmYwuD4Sf1dpXKSOBc5rtPzlul2uHLbx10MSJri4=-----END RSA PRIVATE KEY-----
上面是查看鑰匙串中的公開金鑰和密鑰,那麼怎麼查看.cer呢?可以將其雙擊安裝到鑰匙串中,再按上述方法查看。
參考
1.命令列擷取mobileprovision檔案的UUID
2.Mac Security工具使用總結