Convert PHP code to C#
$30-250 USD
Paid on delivery
I need the PHP code below converted to C# and can run on UWP.
<?php
if (!isset($argv[3]))
{
echo "Syntax: {$argv[0]} TradeReference BTCAddress UpdateID [debug]\n";
die();
}
// Build data
$tradeID = $argv[1];
$btcAddress = $argv[2];
// Plus one because this update increments the updateID anyway
$updateID = $argv[3] + 1;
$data = json_encode(array('version' => (int)1, 'reference' => $tradeID, 'btcaddress' => $btcAddress, 'updateID' => (int)$updateID));
if (isset($argv[4]) && $argv[4] == 'debug')
echo "Data is {$data}\n";
// Get private key
$fp = fopen("[login to view URL]", "r");
if (!$fp)
die("Could not open private key [login to view URL]\n");
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key);
if (!$pkeyid)
die("Private key not valid");
// compute signature
openssl_sign($data, $signature, $pkeyid, 'sha512');
// free the key from memory
openssl_free_key($pkeyid);
echo base64_encode($signature) . "\n";
?>
Tests:
Private key for all tests:
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDHikastc8+I81zCg/qWW8dMr8mqvXQ3qbPAmu0RjxoZVI47tvs
kYlFAXOf0sPrhO2nUuooJngnHV0639iTTEYG1vckNaW2R6U5QTdQ5Rq5u+uV3pMk
7w7Vs4n3urQ6jnqt2rTXbC1DNa/PFeAZatbf7ffBBy0IGO0zc128IshYcwIDAQAB
AoGBALTNl2JxTvq4SDW/3VH0fZkQXWH1MM10oeMbB2qO5beWb11FGaOO77nGKfWc
bYgfp5Ogrql4yhBvLAXnxH8bcqqwORtFhlyV68U1y4R+8WxDNh0aevxH8hRS/1X5
031DJm1JlU0E+vStiktN0tC3ebH5hE+1OxbIHSZ+WOWLYX7JAkEA5uigRgKp8ScG
auUijvdOLZIhHWq7y5Wz+nOHUuDw8P7wOTKU34QJAoWEe771p9Pf/GTA/kr0BQnP
QvWUDxGzJwJBAN05C6krwPeryFKrKtjOGJIniIoY72wRnoNcdEEs3HDRhf48YWFo
riRbZylzzzNFy/gmzT6XJQTfktGqq+FZD9UCQGIJaGrxHJgfmpDuAhMzGsUsYtTr
iRox0D1Iqa7dhE693t5aBG010OF6MLqdZA1CXrn5SRtuVVaCSLZEL/2J5UcCQQDA
d3MXucNnN4NPuS/L9HMYJWD7lPoosaORcgyK77bSSNgk+u9WSjbH1uYIAIPSffUZ
bti+jc1dUg5wb+aeZlgJAkEAurrpmpqj5vg087ZngKfFGR5rozDiTsK5DceTV97K
a3Y+Nzl+XWTxDBWk4YPh2ZlKv402hZEfWBYxUDn5ZkH/bw==
-----END RSA PRIVATE KEY-----
Test 1:
=====
Line to sign:
BYPUS6CJE 3CMCRgEm8HVz3DrWaCCid3vAANE42jcEv9 1
Generated signature:
eud5XV/84oMU6FL+aqhKrorlDwN96q27upqHbpyYkwsMHT6PYbONHspv3m4f1zvmi1miE08NUor7kCxNwoJszsoLa7eiKdoL0XtpDCeXTVuDH2MG4ZiNUOvdJ0TD15E3n97r4iKYMfOY6hzANUCmblI/A9n/PyLypdB4xKnVGnk=
Test 2
=====
Line to sign:
BG2UJ7QE7 3CMCRgEm8HVz3DrWaCCid3vAANE42jcEv9 1
Generated signature:
R7vxhZb8vq+VEZ80MyqIPG9wvQ/7ImHGx8PolxDDiTuG8h4WLQkSAen+vEdoq+shbJEyjfSSuu/z+DulyrvwMvAkGUFwEF2CWVEg1ieJd4SOSpCSjBqaJ2kuKExyzM9cRuZFEMhp5GPaO2JbRsyyoBrS4aURhzqHvQciA2wZeho=
Test 3
=====
Line to sign:
BP4VSFKYF 1BittyL1D1AuiZDjKwQVhM7trpZME55uzm 2
Generated signature:
jOUYUyBSk6etRwsP8Cme3reOKxdlUSTw3zHoo3aEvcNJvwHpq+2Tz24wdUqzqNENLca/OOOyQC8R25oCGD3IoHSIhJfDvf5Mv03Ii+panHIuDiD5YV3AfR03DpkmzbFkUAGqVe+Bu2z7x1nFDQkvLfab7+fq8WYQnMt3Vardv/U=
Project ID: #19765880
About the project
18 freelancers are bidding on average $150 for this job
hi...i have read the php code and i canc convert this into c# in few hours....thanks for sharing so much detauls including test cases
Hi, Dear Employer! How are you? I am really interested in your project. I have enough experience on python, C/C++, C#, java,My SQL programming. I am 100% sure i can satisfy your requirements perfectly. User-Friendly I More
Hi, I am a Full stack developer in Microsoft technologies. I have worked extensively with digital signatures. You can check the reviews in my profile to confirm this. My area of expertise is web application develop More
Hey, employer. I already have read your description carefully. I have 5+ years enough experience in website development. My major skill are HTML5, CSS3, JavaScript, JQuery, Bootstrap, MySQL etc. I am reliable fr More
Hello, Please message me so we can discuss on that. Please view the profile to see more works of mine. Let's discuss so I can provide you more details about me. Waiting for Your Reply soon. Regards, Mousumi
Hello there! My name is Chris, I'm a UK based and native English speaking web developer and app expert with 10 years experience building and maintaining complex web apps and websites. I've built and maintained applic More
Hi, Nice to meet you. I am very interested and available to do your project. Your required task actually map on my high skill sets. Please give me an opportunity to show my expertise in the same. I would like to More
Hi, I'm Gary and I have been programming in different projects platform for the last 10+ years and I have been able to work with up to 600+clients in all these years of my developing. I see you're looking for a python More
Hello, I am Tuan, I am from Vietnam. I have many experience years in digital signature! I have created many app for signing. So I can do solve your problem fastest! Contact me if you interested!
Hi, This is Yazan Ati from Amman, Jordan. Can you please tell me more about your project? If it is based on Microsoft technologies, you will get job done within deadline. For last 14 years of my career I have been wor More