示例#1
0
        public static bool IsValidTransaction(Transaction tx)
        {
            if (tx.senderAddr == Consensus.RewardSenderAddress)
            {
                return(false);
            }
            if (tx._out == 0)
            {
                return(false);
            }
            if (tx.isSigned == false)
            {
                return(false);
            }

            if (Hash.Calc(tx.publicKey) != tx.senderAddr)
            {
                return(false);
            }
            if (RSA.VerifyWithPrivateKey(tx.publicKey, tx.GetTransactionSigniture(), tx.encryptedSign) == false)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        private bool IsValidateKeyPair(string privateKey, string publicKey)
        {
            var sign = RSA.SignWithPrivateKey(privateKey, "teststring");

            return(RSA.VerifyWithPrivateKey(publicKey, "teststring", sign));
        }