public SignatureContext(ISignable signable) { this.Signable = signable; this.ScriptHashes = signable.GetScriptHashesForVerifying(); this.redeemScripts = new byte[ScriptHashes.Length][]; this.signatures = new Dictionary<ECPoint, byte[]>[ScriptHashes.Length]; }
public byte[] Sign(ISignable signable) { byte[] signature; ProtectedMemory.Unprotect(key_exported, MemoryProtectionScope.SameProcess); using (CngKey key = CngKey.Import(key_exported, CngKeyBlobFormat.EccPrivateBlob)) using (ECDsaCng ecdsa = new ECDsaCng(key)) { signature = ecdsa.SignHash(signable.GetHashForSigning()); } ProtectedMemory.Protect(key_exported, MemoryProtectionScope.SameProcess); return signature; }
public SignatureContext(ISignable signable) { this.Signable = signable; this.ScriptHashes = signable.GetScriptHashesForVerifying(); this.signatures = new MultiSigContext[ScriptHashes.Length]; }
/// <summary> /// Returns a boolean which indicates wheather the smartcontract was correctly signed or not /// </summary> /// <returns>If true the smartcontract is correctly signed</returns> public static bool VerifySignature(this ISignable obj) { return(obj.Hash.VerifyMessage(obj.Signature, obj.From)); }