Signing data in C++ compatible with PHP's openssl library
-
20-09-2019 - |
Question
I'm looking for a way to sign some data in C++ code which will then be sent to a PHP script for verification and processing. I want to use the OpenSSL module there, namely the openssl_verify function so I need something compatible with that.
The application will be only for Windows so CryptoAPI might be fine but looking at the samples I don't like it and couldn't get it work, some simple lightweight library would be better. I just need to load a private key and generate the signature for some string.
Solution
As for the Cripto API this example might help you to import a custom private key. Alternatively, you can look at Crypto++.
OTHER TIPS
OpenSSL is originally a C Library, take a look at its documentation.
edit:
Alternatively, have you looked at the CryptoAPI sample application? It does signing as well and you should be able to strip the code you need out of it.