I have some code in nodejs and I am trying to replicate in in C# but I can't seem to find a simple solution like the nodejs one:
var crypto = require('crypto');
var privateKey = '-----BEGIN RSA PRIVATE KEY-----\n'+
/// key removed
'-----END RSA PRIVATE KEY-----';
var publicKey = '-----BEGIN PUBLIC KEY-----\n'+
/// key removed
'-----END PUBLIC KEY-----';
// sign string
var signer = crypto.createSign('sha256');
signer.update('ugus-dev/logo.png');
var sign = signer.sign(privateKey,'base64');
console.log(sign);
// verify signature
var verifier = crypto.createVerify('sha256');
verifier.update('ugus-dev/logo.png');
var ver = verifier.verify(publicKey, sign,'base64');
console.log(ver); // true if signature matches.
Basically i will be singing a string in C# and then verifying the signature of the string in nodeJS with the obove code for verify.
So I am looking for an equvalent of:
// sign string
var signer = crypto.createSign('sha256');
signer.update('ugus-dev/logo.png');
var sign = signer.sign(privateKey,'base64');
in C#.