<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-12-14 11:17 GMT-03:00 Thomas J. Hruska <span dir="ltr"><<a href="mailto:shinelight@shininglightpro.com" target="_blank">shinelight@shininglightpro.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12/14/2016 3:28 AM, Dr. Stephen Henson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Dec 14, 2016, Salz, Rich wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there some equivalent to PHP's openssl_sign_pkcs7 function for C/C++ users?<br>
</blockquote>
<br>
Look at the apps/pkcs7.c file as a starting point.  Get the command line doing what you want, and then work through the code to pull out only the bits you need.<br>
<br>
</blockquote>
<br>
Actually smime.c is the utility you want for PKCS#7. Alternatively cms.c if<br>
you want CMS (the successor to PKCS#7).<br>
<br>
Those though are general purpose utilities which do all sorts of things which<br>
most appications don't care about. There are some demos in demos/smime and<br>
demos/cms which are much simpler.<br>
</blockquote>
<br></span>
PHP is open source software written in C.<br>
<br>
A quick lookup in PHP's git repository (it's source code) turns up:<br>
<br>
<a href="http://git.php.net/?p=php-src.git;a=blob;f=ext/openssl/openssl.c;h=a4b302bd303579d8f3eb62abdd9f312d3fba264d;hb=HEAD#l5148" rel="noreferrer" target="_blank">http://git.php.net/?p=php-src.<wbr>git;a=blob;f=ext/openssl/opens<wbr>sl.c;h=a4b302bd303579d8f3eb62a<wbr>bdd9f312d3fba264d;hb=HEAD#<wbr>l5148</a><br>
<br>
Now the OP has a model to follow for writing a similar wrapper function for their project.<br>
<br>
<br>
I've found that when people mention a specific language (in this case, PHP), they are infatuated with the language but have never bothered to crack open that language's source code to dig into how the language actually works.  To some extent, they view the language as magical.  And to some other extent, they irrationally fear looking at the source code of the language.  Now is the perfect opportunity for the OP to start learning how one of their favorite languages operates behind the scenes with the goal of porting a single function that they are interested in. This approach solves multiple core developer problems at the same time.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Thomas Hruska<br>
Shining Light Productions<br>
<br>
Home of BMP2AVI and Win32 OpenSSL.<br>
<a href="http://www.slproweb.com/" rel="noreferrer" target="_blank">http://www.slproweb.com/</a></font></span><div class="HOEnZb"><div class="h5"><br>
-- <br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailma<wbr>n/listinfo/openssl-users</a><br>
</div></div></blockquote></div><br></div><div class="gmail_extra">As a matter of facts, you're indeed right. I was daunted by the idea of going through PHP's source myself.. </div><div class="gmail_extra">Thanks for the pointers, guys.</div><div class="gmail_extra">I'll report back as soon as I get some progress.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Kind regards,</div><div class="gmail_extra">Anibal.-</div></div>