/// <summary> /// Returns the public key from a given private key /// </summary> /// <param name="privateKey">The key</param> /// <returns></returns> public static string GetPublicKey(this string privateKey) { HexUTF8StringConvertor conv = new HexUTF8StringConvertor(); string hexPrivKey = conv.ConvertToHex(privateKey); return(NetherumSigner::EthECKey.GetPublicAddress(hexPrivKey)); }
/// <summary> /// Signs the given data with a private key /// </summary> /// <param name="data">Data to sign</param> /// <param name="privKey">Private key</param> /// <returns></returns> public static string Sign(string data, string privKey) { NetherumSigner::EthereumMessageSigner gen = new NetherumSigner::EthereumMessageSigner(); HexUTF8StringConvertor conv = new HexUTF8StringConvertor(); string hexPrivKey = conv.ConvertToHex(privKey); return(gen.EncodeUTF8AndSign(data, new NetherumSigner::EthECKey(hexPrivKey))); }