title: openssl smime in ruby/rails
body: <p>So, i have this application that creates a zip file with images and stuff</p>
  
  <p>and i want to sign it using <code>smime</code>.</p>
  
  <p>if i use the terminal command: </p>
  
  <pre><code>openssl smime -binary -sign -passin "pass:MYPASS" -signer ./MyCertificate.pem -inkey ./MyKey.pem -in ./manifest.in -out ./signature.out -outform DER
  </code></pre>
  
  <p>Formated:</p>
  
  <pre><code>openssl smime -binary -sign -passin "pass:MYPASS"             \
           -signer ./MyCertificate.pem -inkey ./MyKey.pem       \
           -in ./manifest.in -out ./signature.out -outform DER
  </code></pre>
  
  <p>the <code>manifest.in</code> is the file witch contains the text to be signed and <code>signature.out</code> is the output file.</p>
  
  <p>i don't know a lot about signing but i believe this code is signing my file using PKCS7</p>
  
  <p>how can i recreate the same result with ruby/rails?</p>
  
  <p>i have tried to look in the documentation of <a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL.html" rel="nofollow">OpenSSL</a> but i couldn't find anything usefull for me</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>if this helps someone,
  this is what the documentation says </p>
  
  <p>i need to build a: </p>
  
  <pre><code>A detached PKCS#7 signature of the manifest
  </code></pre>