tags:

views:

20

answers:

0

Hello everyone,

I've got this code written in PHP:

$text = "some data to sign";
$password = "some password";
$file = "private.pem";
$fp = fopen($file, "r");
$private = fread($fp, filesize($file));
fclose($fp);

$pkeyid = openssl_get_privatekey($private, $password);
openssl_sign($text, $signature, $pkeyid);
$signature = base64_encode($signature);
openssl_free_key($pkeyid);
return $signature;

I need to rewrite it in C#. I can not find any solution how to do the same thing in .NET. Can anybody help?