/// <summary> /// Verifies that the digital signature of the block is valid for the indicated signer. /// </summary> /// <param name="block">The block to verify.</param> /// <returns>If the digital signature is valid for the block.</returns> public async Task <bool> VerifyBlockSignature(Block <T> block) { DigitalSignature signature = block.Signature; string signersPublicKey = await _signerRepository.GetPublicKey(signature.SignerId); return(signersPublicKey == signature.PublicKey && Signer.VerifySignature(signersPublicKey, block.BlockHash, signature.Signature)); }
internal Block(T data, long blockNumber, string previouskHash, string signerId, string signersPublicKey, string signature, DateTime createdDate, string blockHash) { this.BlockNumber = blockNumber; this.Data = data; this.CreatedDate = createdDate; this.PreviousBlockHash = previouskHash; this.BlockHash = blockHash; this.Signature = new DigitalSignature { SignerId = signerId, PublicKey = signersPublicKey }; ApplySignature(signature); }
public void ApplySignature(string signature) { this.Signature.Signature = signature; }