示例#1
0
        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);
        }
示例#2
0
        //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);
        }
示例#3
0
 public HashgraphError SetSignature(BlockSignature bs)
 {
     Signatures[bs.ValidatorHex()] = bs.Signature;
     return(null);
 }