I am generating a valid iPhone Configuration XML Profile and delivering it via a Rails page.
I am trying to figure out how to programmatically sign the XML file with an
Just an FYI — I had to add to_der to the end to get mine to work:
sign = OpenSSL::PKCS7.sign(cert, key, profile, [], OpenSSL::PKCS7::BINARY).to_der
Below lines of code will sign the iPhone configuration XML Profile.
ssl_key_str = File.read("/path/to/private.key”)
ssl_key = OpenSSL::PKey::RSA.new(ssl_key_str)
ssl_cert_str = File.read("/path/to/certificate.crt”)
ssl_cert = OpenSSL::X509::Certificate.new(ssl_cert_str)
profile = File.read("/path/to/profile.mobileconfig")
signed_profile = OpenSSL::PKCS7.sign(ssl_cert, ssl_key, profile, [], OpenSSL::PKCS7::BINARY)