I need to translate the following code to C# from php. What libraries / namespaces do I need to use?
function sign($method, $uuid, $data) {
$merchant_private_key = openssl_get_privatekey(file_get_contents('merchant_private_key.pem'));
$plaintext = $method . $uuid . serialize_data($data);
**openssl_sign($plaintext, $signature, $merchant_private_key);**
return base64_encode($signature);
}
The api can be found over at http://php.net/manual/en/function.openssl-sign.php. Where do I start? I have no idea what the open_ssl sign in php does behind the covers.
Anyone able to help out that knows both php and C# or could someone at least explain what openssl_sign does in the background so that I can port it.
EDIT: 2010-08-18 I can’t find a way to use openssl, it keeps saying it can’t load managedopenssl.dll. Think it is because of my machine being x64.
Thank you for the suggestions.
I have found a solution for my problems. There is a library called ChilKat that we will be using. The answer was found here. Unfortunately this does not work on my x64 machine. Fortunately our servers are all x86 still so we have some more time to look into a workaround.