title: Sign .mobileconfig on a PHP server
body: <p>Could anyone please tell me how to use <code>openssl smime -sign -signer cert.pem -inkey key.pem -certfile ca-bundle.pem -nodetach -outform der -in profile-uns.mobileconfig -out profile-sig.mobileconfig</code> this within PHP (this one worked properly!)?</p>
  
  <p>I tried</p>
  
  <pre><code>$path = __DIR__ . DIRECTORY_SEPARATOR;  // my actual directory
  $infilename = $path . 'profile.mobileconfig'; // my unsigned profile
  $outfilename = $path . 'profile-sig.mobileconfig'; // my signed profile
  $signcert = file_get_contents($path . 'cert.pem'); // my certificate to sign
  $privkey = file_get_contents($path . 'key.pem'); // my private key of the certificate
  $extracerts = $path . 'ca-bundle.pem'; // the cert chain of my CA
  
  echo openssl_pkcs7_sign($infilename, $outfilename , $signcert, $privkey, array(), PKCS7_NOATTR,$extracerts);
  </code></pre>
  
  <p>without success. I also tried all of the PKCS7 attributes...</p>