title: BouncyCastle sign in PHP/OpenSSL
body: <p>I want to sign content with OpenSSL in PHP (or cli linux OpenSSL). Signatures generated by BouncyCastle in Java:</p>
  
  <pre><code>        ContentInfo contentInfo = new ContentInfo(tokenToSignBytes);
          SignedCms signedCms = new SignedCms(contentInfo, true);
  
  
          CmsSigner cmsSigner = new CmsSigner(signerCert);
  
          signedCms.ComputeSignature(cmsSigner, false);
  
          return signedCms.Encode("DER");
  </code></pre>
  
  <p>Gives other result than <code>openssl_sign();</code> in PHP or openssl via command line.</p>
  
  <p><strong>How to generate same signature as bouncycastle generates but in PHP/cli?</strong></p>
  
  <p>Thanks
  Leo</p>