Beispiel #1
0
        public void serializePassword()
        {
            Wotan.encrypter e = (new encrypterFactory()).create(encrypterType.AES);

            string          s       = "Hello World";
            encryptedString encrypt = new encryptedString(s);
            var             test    = encrypt.decrypted;

            using (var serializer = new contractSerializer <encryptedString>())
            {
                using (MemoryStream ms = (MemoryStream)serializer.fromObject(encrypt))
                {
                    using (StreamReader reader = new StreamReader(ms))
                    {
                        string res = reader.ReadToEnd();

                        Assert.AreEqual(res,
                                        "<encryptedString xmlns=\"http://schemas.datacontract.org/2004/07/Wotan\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">" +
                                        "<encrypt>true</encrypt>" +
                                        "<string>cybHxAg/UGmwBnuStAOaNA==</string>" +
                                        "<method>AES</method>" +
                                        "</encryptedString>");
                    }
                }
            }
        }
Beispiel #2
0
        public void encrypterFactory()
        {
            var fact = new encrypterFactory();

            Wotan.encrypter e = fact.create(encrypterType.AES);

            Assert.IsInstanceOfType(e, typeof(AESEncrypter));
        }
Beispiel #3
0
        public void encryptAES()
        {
            Wotan.encrypter e = (new encrypterFactory()).create(encrypterType.AES);

            string s       = "Hello World";
            string encrypt = e.encrypt(s);
            string decrypt = e.decrypt(encrypt);

            Assert.AreEqual(decrypt, s);
        }