Ejemplo n.º 1
0
 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];
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 public SignatureContext(ISignable signable)
 {
     this.Signable = signable;
     this.ScriptHashes = signable.GetScriptHashesForVerifying();
     this.signatures = new MultiSigContext[ScriptHashes.Length];
 }
Ejemplo n.º 4
0
 /// <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));
 }