Created
June 1, 2012 18:25
-
-
Save mlaster/2854189 to your computer and use it in GitHub Desktop.
Decode provisioning profile
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 characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'openssl' | |
begin | |
gem 'plist', '~> 3.1.0' | |
require 'plist' | |
rescue Gem::LoadError | |
abort "Please install plist gem with:\n sudo gem install plist" | |
end | |
raw = File.read(ARGV[0]) | |
# Extract the plist from the binary | |
regexp = /.*(<\?xml .*<\/plist>).*/mn | |
plist = raw.match(regexp)[1] | |
dict = Plist::parse_xml(plist) | |
puts dict.inspect | |
devcerts = dict["DeveloperCertificates"] | |
decoded_certs = [] | |
devcerts.each do |data| | |
cert = OpenSSL::X509::Certificate.new(data.read) | |
decoded_certs << cert | |
end | |
puts "" | |
puts "Certificates: #{decoded_certs.length}" | |
puts "" | |
decoded_certs.each do |cert| | |
puts "#{cert.to_text}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment