title: How to Decode/extract smime.p7m file contents of SMIME signed email using Ruby OpenSSL library
body: <p>I have a signed email message as string. And I want to get string with whole unsigned message with attachments and body that I can parse with, for example, Mail gem.</p>
  
  <p>I found question: <a href="https://stackoverflow.com/questions/443580/decode-extract-smime-p7m-file-contents-email-with-embedded-files-with-openssl">Decode/extract smime.p7m file contents (email with embedded files) with OpenSSL?</a> and now I know how to do it via command line. </p>
  
  <p>I can dump my string to temp file, decrypt via command line and then parse it. But this is not so good idea. I want to use OpenSSL library for Ruby.</p>