예제 #1
0
        /// <summary>
        /// Signs this transaction,
        /// Only signed transaction can be accepted in chain.
        ///
        /// This makes attacker cannot create fake/manipulated transaction.
        ///
        ///    * ONLY wallet owner can make valid transaction with PRIVATE KEY.
        ///    * EVERYONE can validation the transaction with PUBLIC KEY.
        /// </summary>
        public void Sign(string _privateKey, string _publicKey)
        {
            var original = GetTransactionSigniture();

            encryptedSign = RSA.SignWithPrivateKey(_privateKey, original);
            publicKey     = _publicKey;
        }
예제 #2
0
        private bool IsValidateKeyPair(string privateKey, string publicKey)
        {
            var sign = RSA.SignWithPrivateKey(privateKey, "teststring");

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