public (bool res, HashgraphError err) Verify(BlockSignature sig) { var signBytes = Body.Hash(); var pubKey = CryptoUtils.ToEcdsaPub(sig.Validator); var signature = sig.Signature; return(CryptoUtils.Verify(pubKey, signBytes, signature), null); }
//ecdsa sig public (BlockSignature bs, HashgraphError err) Sign(CngKey privKey) { var signBytes = Body.Hash(); var signiture = CryptoUtils.Sign(privKey, signBytes); var bs = new BlockSignature { Validator = CryptoUtils.FromEcdsaPub(privKey), Index = Index(), Signature = signiture }; return(bs, null); }
public HashgraphError SetSignature(BlockSignature bs) { Signatures[bs.ValidatorHex()] = bs.Signature; return(null); }