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