Ejemplo n.º 1
0
 public void SendMessageTo(string message, byte[] otherPublicKey)
 {
     if (message.Length > 0)
     {
         blockchain.AddBlock(AESCrypto.EncryptToString(message, this.GetSharedSecretString(otherPublicKey)));
     }
 }
Ejemplo n.º 2
0
        public void CheckMessagesFrom(byte[] otherPublicKey)
        {
            int blocksCount = blockchain.GetBlocksCount();

            for (int i = 1; i < blocksCount; i++)
            {
                string result = AESCrypto.DecryptToString(blockchain.GetBlockData(i), this.GetSharedSecretString(otherPublicKey));
                if (result.Length != 0)
                {
                    Console.WriteLine("block " + i + ":" + result);
                }
            }
        }