The Activeledger C# ECC SDK has been built to provide an easy way to generate an ECC keypair that can be used to sign transactions to be sent to the Activeledger network.
Read Activeledgers documentation
The SDK currently supports the following functions:
- Generate a new ECC keypair provided as HEX strings
- Sign a string using the generated private key
The generate method returns an array containing the public and private keys as HEX strings.
using ActiveledgerECC;
namespace MyNamespace
{
public class MyClass
{
private void MyMethod()
{
KeyGenerator keyGen;
keyGen = new KeyGenerator();
String prv, pub;
prv = keyGen.GetPrivateKey();
pub = keyGen.GetPublicKey();
Console.WriteLine("Private key HEX: " + prv + "\n");
Console.WriteLine("Public key HEX: " + pub + "\n");
}
}
}
The Signer class takes the private key as a HEX string and provides a method to sign a string.
The sign method takes the data to be signed This must be a valid JSON string and returns the signature base64 encoded.
Note: The data must be JSON.
using ActiveledgerECC;
namespace MyNamespace
{
public class MyClass
{
private void MyMethod(String privateKeyHex)
{
Signer signer;
signer = new Signer(privateKeyHex);
String signature;
signature = signer.Sign(data);
Console.WriteLine("Signature: " + signature + "\n");
}
}
}
This project is licensed under the MIT License