[openssl-users] Signing an XML file

Thomas J. Hruska shinelight at shininglightpro.com
Wed Dec 14 14:17:56 UTC 2016


On 12/14/2016 3:28 AM, Dr. Stephen Henson wrote:
> On Wed, Dec 14, 2016, Salz, Rich wrote:
>
>>> Is there some equivalent to PHP's openssl_sign_pkcs7 function for C/C++ users?
>>
>> 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.
>>
>
> Actually smime.c is the utility you want for PKCS#7. Alternatively cms.c if
> you want CMS (the successor to PKCS#7).
>
> Those though are general purpose utilities which do all sorts of things which
> most appications don't care about. There are some demos in demos/smime and
> demos/cms which are much simpler.

PHP is open source software written in C.

A quick lookup in PHP's git repository (it's source code) turns up:

http://git.php.net/?p=php-src.git;a=blob;f=ext/openssl/openssl.c;h=a4b302bd303579d8f3eb62abdd9f312d3fba264d;hb=HEAD#l5148

Now the OP has a model to follow for writing a similar wrapper function 
for their project.


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.

-- 
Thomas Hruska
Shining Light Productions

Home of BMP2AVI and Win32 OpenSSL.
http://www.slproweb.com/


More information about the openssl-users mailing list