title: How to decrypt smime.p7m file in DER format using OpenSSL in C code.
body: <p>I am trying to decrypt emails using openssl. </p>
  
  <p>I am getting smime.p7m file from the server. But it is in DER format. </p>
  
  <p>I can decrypt this file using command prompt, with the command </p>
  
  <pre><code>openssl smime -decrypt -in openssl_working_smime.p7m -inform DER -inkey mycert.pem &gt; dec_mail.eml
  </code></pre>
  
  <p>But now I want to do this using C code. </p>
  
  <p>Right now I am trying to do using - </p>
  
  <pre><code>SMIME_read_PKCS7()
  </code></pre>
  
  <p>But this returns null with </p>
  
  <pre><code>SMIME_read_ASN1:no content type:asn_mime.c:451: 
  </code></pre>
  
  <p>error</p>
  
  <p>Any ideas how to do it? </p>