Signing iPhone Configuration XML Profile with Ruby on Rails

后端 未结 2 629
故里飘歌
故里飘歌 2021-02-06 17:28

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

相关标签:
2条回答
  • 2021-02-06 17:38

    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
    
    0 讨论(0)
  • 2021-02-06 17:50

    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)
    
    0 讨论(0)
提交回复
热议问题