Created
April 12, 2012 20:17
Revisions
-
command-tab created this gist
Apr 12, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # Parse a provisioning profile # Extract the first DeveloperCertificates <data> entry # Remove any leading whitespace # Remove any blank lines # Base64 decode the blob # Parse the .cer with OpenSSL # Extract the first line, which is the certificate subject (the rest is the cert blob) # End up with a string like: subject= /UID=AABBCCDDEE/CN=iPhone Developer: First Last (FFGGHHIIJJ)/C=US # Note: Uses xmlstarlet to parse the plist, but you could probably use PlistBuddy or grep, too security cms -D -i "/path/to/some.mobileprovision" | \ xml sel -t -v "/plist/dict/key[. = 'DeveloperCertificates']/following-sibling::array[1]/data[1]" | \ awk '{print $1}' | sed '/^$/d' | base64 -D | openssl x509 -subject -inform der | head -n 1