Ruby How to Signing iPhone Configuration XML Profile with Ruby on Rails?

jean · January 16, 2012 · Last by sunfjun replied at January 21, 2020 · 3686 hits

使用 openssl 命令行就可以 sign 出正常的.mobileconfig file,但是使用 ruby 却不行

def mobile_config
  ssl_key_str = File.read(Rails.root + "site.key") 
  ssl_key = OpenSSL::PKey::RSA.new(ssl_key_str)

  ssl_cert_str = File.read(Rails.root + "site.crt")
  ssl_cert = OpenSSL::X509::Certificate.new(ssl_cert_str)

  profile = File.read("/Users/zhang/Desktop/no_sign.mobileconfig")

  signed_profile = OpenSSL::PKCS7.sign(ssl_cert, ssl_key, profile, [], OpenSSL::PKCS7::BINARY)

  send_file signed_profile
end

原理参考了这篇文章 http://www.rootmanager.com/iphone-ota-configuration/iphone-ota-setup-with-signed-mobileconfig.html

在谷歌上搜到一个解决途径,但是不好使 http://stackoverflow.com/questions/4446247/signing-iphone-configuration-xml-profile-with-ruby-on-rails

最近也在搞这个,也不行,但是 PHP 的 openssl_pkcs7_sign 没问题

我按照这个测试了,是可以用的。

You need to Sign in before reply, if you don't have an account, please Sign up first.