sign static method
sign a message with private key
Implementation
static String sign(String msg, String prvkey) {
var prvHex = lyraDec(prvkey);
var d = BigInt.parse('+' + prvHex, radix: 16);
var eccDomain = ECDomainParameters('secp256r1');
var privParams = PrivateKeyParameter(ECPrivateKey(d, eccDomain));
var signParams = ParametersWithRandom(privParams, NullSecureRandom());
var sig = ECDSASigner(SHA256Digest());
sig.init(true, signParams);
var signatur = sig.generateSignature(Uint8List.fromList(utf8.encode(msg)));
// convert to P1393
var ecsgn = signatur as ECSignature;
var rb = hex.decode(ecsgn.r.toRadixString(16));
var sb = hex.decode(ecsgn.s.toRadixString(16));
var lst = rb + sb;
return Base58Encode(lst);
}