コード例 #1
0
        private bool IsValidSignature(PuzzleSolution solution, HashBase hash, out ECDSASignature signature)
        {
            signature = null;
            var escrow = EscrowScriptPubKeyParameters.GetFromCoin(InternalState.EscrowedCoin);

            try
            {
                var key = new XORKey(solution);
                signature = new ECDSASignature(key.XOR(hash.Commitment.Promise));
                var ok = escrow.Initiator.Verify(hash.GetHash(), signature);
                if (!ok)
                {
                    signature = null;
                }
                return(ok);
            }
            catch
            {
            }
            return(false);
        }
コード例 #2
0
 private bool IsValidSignature(PuzzleSolution solution, HashBase hash, out PubKey signer, out ECDSASignature signature)
 {
     signer    = null;
     signature = null;
     try
     {
         var key = new XORKey(solution);
         signature = new ECDSASignature(key.XOR(hash.Commitment.Promise));
         foreach (var sig in GetExpectedSigners())
         {
             if (sig.Verify(hash.GetHash(), signature))
             {
                 signer = sig;
                 return(true);
             }
         }
         return(false);
     }
     catch
     {
     }
     return(false);
 }