Esempio n. 1
0
 public void TestYayDecryptionBasic()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     string strMessage = "q/xJqqN6qbiZMXYmiQC1Fw==";
     //decrypt
     string dec = pc.decrypt(strMessage);
     //deserialize again
     Assert.AreEqual("yay!", dec);
 }
Esempio n. 2
0
        public void TestYayDecryptionBasic()
        {
            PubnubCrypto pc         = new PubnubCrypto("enigma");
            string       strMessage = "q/xJqqN6qbiZMXYmiQC1Fw==";
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize again
            Assert.AreEqual("yay!", dec);
        }
Esempio n. 3
0
        public void TestHashDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=";
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("{\"foo\":{\"bar\":\"foobar\"}}", dec);
        }
Esempio n. 4
0
        public void TestNullDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = null;
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("", dec);
        }
Esempio n. 5
0
        public void TestStuffcanDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF";
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("{\"this stuff\":{\"can get\":\"complicated!\"}}", dec);
        }
Esempio n. 6
0
        public void TestNullDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = null;
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("", dec);
        }
Esempio n. 7
0
        public void TestPubNubDecryption1()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=";
            //JavaScriptSerializer js = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize
            strMessage = JsonConvert.DeserializeObject <string>(dec);
            Assert.True(("Pubnub Messaging API 1").Equals(strMessage));
        }
Esempio n. 8
0
        public void TestPubNubDecryption2()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized string
            string strMessage = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=";
            //Decrypt
            string dec = pc.decrypt(strMessage);

            //Deserialize
            //JavaScriptSerializer js = new JavaScriptSerializer();
            strMessage = JsonConvert.DeserializeObject <string>(dec);
            Assert.True(("Pubnub Messaging API 2").Equals(strMessage));
        }
Esempio n. 9
0
        public void TestPubNubDecryption2()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized string
            string strMessage = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=";
            //Decrypt
            string dec = pc.decrypt(strMessage);
            //Deserialize
            JavaScriptSerializer js = new JavaScriptSerializer();

            strMessage = js.Deserialize <string>(dec);
            Assert.AreEqual("Pubnub Messaging API 2", strMessage);
        }
Esempio n. 10
0
        public void TestPubNubDecryption1()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage       = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=";
            JavaScriptSerializer js = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize
            strMessage = js.Deserialize <string>(dec);
            Assert.AreEqual("Pubnub Messaging API 1", strMessage);
        }
Esempio n. 11
0
        public void TestUnicodeCharsDecryption()
        {
            PubnubCrypto         pc         = new PubnubCrypto("enigma");
            string               strMessage = "+BY5/miAA8aeuhVl4d13Kg==";
            JavaScriptSerializer js         = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize
            strMessage = js.Deserialize <string>(dec);

            Assert.AreEqual("漢語", strMessage);
        }
Esempio n. 12
0
        public void TestGermanCharsDecryption()
        {
            PubnubCrypto         pc         = new PubnubCrypto("enigma");
            string               strMessage = "stpgsG1DZZxb44J7mFNSzg==";
            JavaScriptSerializer js         = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize
            strMessage = js.Deserialize <string>(dec);

            Assert.AreEqual("ÜÖ", strMessage);
        }
Esempio n. 13
0
        public void TestGermanCharsDecryption()
        {
            PubnubCrypto pc         = new PubnubCrypto("enigma");
            string       strMessage = "stpgsG1DZZxb44J7mFNSzg==";
            //JavaScriptSerializer js = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize
            strMessage = JsonConvert.DeserializeObject <string>(dec);

            Assert.True(("ÜÖ").Equals(strMessage));
        }
Esempio n. 14
0
        public void TestUnicodeCharsDecryption()
        {
            PubnubCrypto pc         = new PubnubCrypto("enigma");
            string       strMessage = "+BY5/miAA8aeuhVl4d13Kg==";
            //JavaScriptSerializer js = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize
            strMessage = JsonConvert.DeserializeObject <string>(dec);

            Assert.True(("漢語").Equals(strMessage));
        }
Esempio n. 15
0
        public void TestObjectDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized
            string strMessage = "IDjZE9BHSjcX67RddfCYYg==";
            //Decrypt
            string dec = pc.decrypt(strMessage);
            //create an object
            Object obj = new Object();
            //Serialize the object
            //JavaScriptSerializer js = new JavaScriptSerializer();
            string res = JsonConvert.SerializeObject(obj);

            Assert.True(dec.Equals(res));
        }
Esempio n. 16
0
        public void TestObjectDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized
            string strMessage = "IDjZE9BHSjcX67RddfCYYg==";
            //Decrypt
            string dec = pc.decrypt(strMessage);
            //create an object
            Object obj = new Object();
            //Serialize the object
            JavaScriptSerializer js = new JavaScriptSerializer();
            string res = js.Serialize(obj);

            Assert.AreEqual(dec, res);
        }
Esempio n. 17
0
        public void TestMyObjectDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized
            string strMessage = "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=";
            //Decrypt
            string dec = pc.decrypt(strMessage);
            //create an object of the custom class
            CustomClass          cc = new CustomClass();
            JavaScriptSerializer js = new JavaScriptSerializer();
            //Serialize it
            string res = js.Serialize(cc);

            Assert.AreEqual(dec, res);
        }
Esempio n. 18
0
        public void TestArrayDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Input the deserialized string
            string strMessage = "Ns4TB41JjT2NCXaGLWSPAQ==";
            //decrypt
            string dec = pc.decrypt(strMessage);

            //create a serialized object
            object []            objArr = {};
            JavaScriptSerializer js     = new JavaScriptSerializer();
            string res = js.Serialize(objArr);

            //compare the serialized object and the return of the Decrypt method
            Assert.AreEqual(res, dec);
        }
Esempio n. 19
0
        public void TestYayDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\"";
            //Non deserialized string
            string strMessage = "\"Wi24KS4pcTzvyuGOHubiXg==\"";

            //Deserialize
            //JavaScriptSerializer js = new JavaScriptSerializer();
            strMessage = JsonConvert.DeserializeObject <string>(strMessage);
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize again
            strMessage = JsonConvert.DeserializeObject <string>(dec);
            Assert.True(("yay!").Equals(strMessage));
        }
Esempio n. 20
0
        public void TestYayDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\"";
            //Non deserialized string
            string strMessage = "\"Wi24KS4pcTzvyuGOHubiXg==\"";
            //Deserialize
            JavaScriptSerializer js = new JavaScriptSerializer();

            strMessage = js.Deserialize <string>(strMessage);
            //decrypt
            string dec = pc.decrypt(strMessage);

            //deserialize again
            strMessage = js.Deserialize <string>(dec);
            Assert.AreEqual("yay!", strMessage);
        }
Esempio n. 21
0
 public void TestYayDecryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //string strMessage= "\"q/xJqqN6qbiZMXYmiQC1Fw==\"";
     //Non deserialized string
     string strMessage = "\"Wi24KS4pcTzvyuGOHubiXg==\"";
     //Deserialize 
     JavaScriptSerializer js = new JavaScriptSerializer();
     strMessage = js.Deserialize<string>(strMessage);
     //decrypt
     string dec = pc.decrypt(strMessage);
     //deserialize again
     strMessage = js.Deserialize<string>(dec);
     Assert.AreEqual("yay!", strMessage);
 }
Esempio n. 22
0
        public void TestMyObjectDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized
            string strMessage = "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=";
            //Decrypt
            string dec = pc.decrypt(strMessage);
            //create an object of the custom class
            CustomClass cc = new CustomClass();

            JavaScriptSerializer js = new JavaScriptSerializer();
            //Serialize it
            string res = js.Serialize(cc);

            Assert.AreEqual(res, dec);
        }
Esempio n. 23
0
        public void TestObjectDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized
            string strMessage = "IDjZE9BHSjcX67RddfCYYg==";
            //Decrypt
            string dec = pc.decrypt(strMessage);
            //create an object
            Object obj = new Object();
            //Serialize the object
            JavaScriptSerializer js = new JavaScriptSerializer();
            string res = js.Serialize(obj);

            Assert.AreEqual(res, dec);
        }
Esempio n. 24
0
 public void TestPubNubDecryption1()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //deserialized string
     string strMessage = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=";
     JavaScriptSerializer js = new JavaScriptSerializer();
     //decrypt
     string dec = pc.decrypt(strMessage);
     //deserialize
     strMessage = js.Deserialize<string>(dec);
     Assert.AreEqual("Pubnub Messaging API 1", strMessage);
 }
Esempio n. 25
0
 public void TestPubNubDecryption2()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //Deserialized string    
     string strMessage = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=";
     //Decrypt
     string dec = pc.decrypt(strMessage);
     //Deserialize
     JavaScriptSerializer js = new JavaScriptSerializer();
     strMessage = js.Deserialize<string>(dec);
     Assert.AreEqual("Pubnub Messaging API 2", strMessage);
 }
Esempio n. 26
0
        public void TestStuffcanDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF";
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("{\"this stuff\":{\"can get\":\"complicated!\"}}", dec);
        }
Esempio n. 27
0
        public void TestHashDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=";
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("{\"foo\":{\"bar\":\"foobar\"}}", dec);
        }
Esempio n. 28
0
        public void TestUnicodeCharsDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            string strMessage = "+BY5/miAA8aeuhVl4d13Kg==";
            JavaScriptSerializer js = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);
            //deserialize
            strMessage = js.Deserialize<string>(dec);

            Assert.AreEqual("漢語", strMessage);
        }
Esempio n. 29
0
        public void TestGermanCharsDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            string strMessage = "stpgsG1DZZxb44J7mFNSzg==";
            JavaScriptSerializer js = new JavaScriptSerializer();
            //decrypt
            string dec = pc.decrypt(strMessage);
            //deserialize
            strMessage = js.Deserialize<string>(dec);

            Assert.AreEqual("ÜÖ", strMessage);
        }
Esempio n. 30
0
 public void TestArrayDecryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //Input the deserialized string
     string strMessage = "Ns4TB41JjT2NCXaGLWSPAQ==";
     //decrypt
     string dec = pc.decrypt(strMessage);
     //create a serialized object
     object[] objArr = { };
     JavaScriptSerializer js = new JavaScriptSerializer();
     string res = js.Serialize(objArr);
     //compare the serialized object and the return of the Decrypt method
     Assert.AreEqual(res, dec);
 }