示例#1
0
        public void TestArrayEncryptionMiniJson()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");

            //create an empty array object
            object[] objArr = { };
            string   strArr = Common.SerializeMiniJson(objArr);
            //Encrypt
            string encrypted = pubnubCrypto.Encrypt(strArr);

            Assert.True(("Ns4TB41JjT2NCXaGLWSPAQ==").Equals(encrypted));
        }
示例#2
0
        public void TestYayEncryptionMiniJson()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
            //deserialized string
            string message = "yay!";

            //serialize the string
            message = Common.SerializeMiniJson(message);
            Console.WriteLine(message);
            //Encrypt
            string encrypted = pubnubCrypto.Encrypt(message);

            Assert.True(("Wi24KS4pcTzvyuGOHubiXg==").Equals(encrypted));
        }
示例#3
0
        public void TestArrayDecryptionUsingMiniJson()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
            //Input the deserialized string
            string message = "Ns4TB41JjT2NCXaGLWSPAQ==";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt(message);

            //create a serialized object
            object[] objArr = { };
            string   result = Common.SerializeMiniJson(objArr);

            //compare the serialized object and the return of the Decrypt method
            Assert.True((result).Equals(decrypted));
        }