title: Manually sign Push Package with openssl for Safari Push Notifications
body: <p>The documentation says <code>The signature is a PKCS #7 detached signature of the manifest file</code> but how does one do that with openssl?</p>
  
  <p>For Passbook I found these commands:</p>
  
  <pre><code>openssl pkcs12 -passin pass:test -in ./Certificates.p12 -clcerts -nokeys -out ./certificate.pem
  openssl pkcs12 -passin pass:test -in ./Certificates.p12 -nocerts -out ./key.pem
  openssl smime -passin pass:test -binary -sign -signer ./certificate.pem -inkey ./key.pem -in ./pushPackage.raw/manifest.json -out ./pushPackage.raw/signature xs-outform DER
  </code></pre>
  
  <p>Also tried with the WWDR certificate:</p>
  
  <pre><code>openssl smime -passin pass:test -binary -sign -certfile ~/Downloads/AppleWWDRCA.cer -signer ./certificate.pem -inkey ./key.pem -in ./pushPackage.raw/manifest.json -out ./pushPackage.raw/signature xs-outform DER
  </code></pre>
  
  <p>And zip it with:</p>
  
  <pre><code>zip -r ../example.zip . -x '*.DS_Store'
  </code></pre>
  
  <p>But I still get "<code>Signature verification of push package failed</code>".</p>