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); }
private bool IsValidateKeyPair(string privateKey, string publicKey) { var sign = RSA.SignWithPrivateKey(privateKey, "teststring"); return(RSA.VerifyWithPrivateKey(publicKey, "teststring", sign)); }