Signing iPhone Configuration XML Profile with Ruby on Rails

后端 未结 2 643
故里飘歌
故里飘歌 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: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)
    

提交回复
热议问题