using System;
using System.Security.Cryptography;
class Helo
{
private static string GetPemPrivateKey()
{
string privatekey = @"-----BEGIN PRIVATE KEY-----
.....
-----END PRIVATE KEY-----";
privatekey = privatekey.Replace("-----BEGIN PRIVATE KEY-----", "")
.Replace("-----END PRIVATE KEY-----", "")
.Replace("n", "")
.Replace("r", "");
return privatekey;
}
static void Main(string[] args)
{
string message = "hello world";
byte[] data = System.Text.Encoding.UTF8.GetBytes(message);
Console.WriteLine( Convert.FromBase64String(GetPemPrivateKey()));
using (ECDsa ecdsa = ECDsa.Create())
{
ecdsa.ImportPkcs8PrivateKey(Convert.FromBase64String(GetPemPrivateKey()), out _);
byte[] signature = ecdsa.SignData(data, HashAlgorithmName.SHA256);
Console.WriteLine("Signature: " + Convert.ToBase64String(signature));
}
}
}
if i sign using this .NET code and try to verify using GO CODE its not working it says tags don't match (16 vs {class:3 tag:1 length:39 isCompound:false}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} @2
.
but if if i sign with SIGNER and try to VERIFIER with this is also working.
i want to make .NET comparable with VERIFIER.
and if i try to verify with VERIFIER2 this go code its working good.
i want to use VERIFIER dont want to change code on verification part. C# can be changed.