public void DeriveKey_CreateCommonKeyAndEncryptString_Pass()
        {
            ECDiffieHellmanAgreement agreement;
            byte[] commonKey;
            byte[] iv;
            string messageFromBob = "Hello my friend, how are you?";
            string encrypted;
            string decrypted;

            using(var alice = new ECDiffieHellmanCipher<ECDiffieHellmanCng>())
            {
                agreement = alice.Agreement;
                using(var bob = new ECDiffieHellmanCipher<ECDiffieHellmanCng>(agreement))
                {
                    commonKey = alice.DeriveKey(bob.PublicKey);
                    using (var cipher = new SymmetricCipher<AesManaged>(commonKey, out iv))
                        encrypted = cipher.EncryptToString(messageFromBob);
                }

                using (var cipher = new SymmetricCipher<AesManaged>(commonKey, iv))
                    decrypted = cipher.DecryptToString(encrypted);
            }

            Assert.AreEqual(messageFromBob, decrypted);
        }
        public void DeriveKey_CompareCommonKey_Pass()
        {
            ECDiffieHellmanAgreement agreement;
            byte[] aliceKey;
            byte[] bobKey;

            using (var alice = new ECDiffieHellmanCipher<ECDiffieHellmanCng>())
            {
                agreement = alice.Agreement;
                using (var bob = new ECDiffieHellmanCipher<ECDiffieHellmanCng>(agreement))
                {
                    aliceKey = alice.DeriveKey(bob.PublicKey);
                    bobKey = bob.DeriveKey(alice.PublicKey);
                }
            }

            CollectionAssert.AreEqual(aliceKey, bobKey);
        }