コード例 #1
0
        public void ShouldDecrypt()
        {
            string strPassword       = "******";
            var    encryptedDocument = "W259NpVEpSJZDnp1XGab17NzVKF9qsKcB1szMVpgDoA=";

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

            Assert.AreEqual(decryptedDocument, "someText to encrypt");
        }
コード例 #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);
        }