public void SendMessageTo(string message, byte[] otherPublicKey) { if (message.Length > 0) { blockchain.AddBlock(AESCrypto.EncryptToString(message, this.GetSharedSecretString(otherPublicKey))); } }
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); } } }