示例#1
0
        public void ShouldEncrypt()
        {
            string strPassword = "******";
            string document    = "someText to encrypt";

            var encrAlgo          = new RijndaelManagedStringSymmetricAlgorithm(strPassword);
            var encryptedDocument = encrAlgo.Encrypt(document);

            Assert.AreNotEqual(document, encryptedDocument);
            Assert.AreEqual("W259NpVEpSJZDnp1XGab17NzVKF9qsKcB1szMVpgDoA=", encryptedDocument);
        }
示例#2
0
        public void ShouldRoundTripComplex()
        {
            string strPassword = "******";
            string document    = @"This
                                is
                                a
                                multiline
                                complex
                                document
                                to
                                encrypt.";

            var encrAlgo          = new RijndaelManagedStringSymmetricAlgorithm(strPassword);
            var encryptedDocument = encrAlgo.Encrypt(document);
            var decryptedDocument = encrAlgo.Decrypt(encryptedDocument);

            Assert.AreEqual(decryptedDocument, document);
        }