当前位置: 首页>>代码示例>>C#>>正文


C# PubNub_Messaging.PubnubCrypto类代码示例

本文整理汇总了C#中PubNub_Messaging.PubnubCrypto的典型用法代码示例。如果您正苦于以下问题:C# PubnubCrypto类的具体用法?C# PubnubCrypto怎么用?C# PubnubCrypto使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PubnubCrypto类属于PubNub_Messaging命名空间,在下文中一共展示了PubnubCrypto类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestNullDecryption

        public void TestNullDecryption()
        {
            bool isExpectedException = false;
            string dec = "";
            ThreadPool.QueueUserWorkItem((s) =>
                {
                    PubnubCrypto pc = new PubnubCrypto("enigma");
                    //deserialized string
                    string strMessage = null;
                    try
                    {
                        //decrypt
                        dec = pc.decrypt(strMessage);
                    }
                    catch (ArgumentNullException ane)
                    {
                        isExpectedException = true;
                    }

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            //Assert.AreEqual("", dec);
                            Assert.IsTrue(isExpectedException);
                            TestComplete();
                        });
                });
        }
开发者ID:hart404,项目名称:pubnub-api,代码行数:27,代码来源:EncryptionTests.cs

示例2: BasicEncryptionDecryptionTests

        public static void BasicEncryptionDecryptionTests()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");

            string enc = pc.encrypt("Pubnub Messaging API 1");
            Console.WriteLine ("Pubnub Messaging API 1 = " + enc);
            Console.WriteLine ("dec = " + pc.decrypt(enc));

            enc = pc.encrypt("yay!");
            Console.WriteLine ("yay = " + enc);
            Console.WriteLine ("dec = " + pc.decrypt(enc));

            Console.WriteLine ("Wi24KS4pcTzvyuGOHubiXg==: = " + pc.decrypt("Wi24KS4pcTzvyuGOHubiXg=="));
            Console.WriteLine ("f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=: = " + pc.decrypt("f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54="));
            Console.WriteLine ("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=: = " + pc.decrypt("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0="));
            Console.WriteLine ("zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF = " + pc.decrypt("zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF"));
            Console.WriteLine ("GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g= = " + pc.decrypt("GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g="));

            Console.WriteLine ("IDjZE9BHSjcX67RddfCYYg== = " + pc.decrypt("IDjZE9BHSjcX67RddfCYYg=="));
            Console.WriteLine ("Ns4TB41JjT2NCXaGLWSPAQ== = " + pc.decrypt("Ns4TB41JjT2NCXaGLWSPAQ=="));

            Console.WriteLine ("+BY5/miAA8aeuhVl4d13Kg== = " + pc.decrypt("+BY5/miAA8aeuhVl4d13Kg=="));

            Console.WriteLine ("Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE= = " + pc.decrypt("Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE="));
            Console.WriteLine ("q/xJqqN6qbiZMXYmiQC1Fw==: = " + pc.decrypt("q/xJqqN6qbiZMXYmiQC1Fw=="));
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:26,代码来源:PubNub-Example2.cs

示例3: TestYayDecryptionBasic

 public void TestYayDecryptionBasic()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     string strMessage = "q/xJqqN6qbiZMXYmiQC1Fw==";
     //decrypt
     string dec = pc.decrypt(strMessage);
     //deserialize again
     Assert.AreEqual("yay!", dec);
 }
开发者ID:hart404,项目名称:pubnub-api,代码行数:9,代码来源:EncryptionTests.cs

示例4: TestNullEncryption

 public void TestNullEncryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //serialized string
     string strMessage = null;
     
     //encrypt
     string enc = pc.encrypt(strMessage);
 }
开发者ID:hart404,项目名称:pubnub-api,代码行数:9,代码来源:EncryptionTests.cs

示例5: TestYayEncryptionBasic

        public void TestYayEncryptionBasic ()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage= "yay!";
            //pubnub.publish(channel, strMessage, Common.DisplayReturnMessage);
            //Encrypt
            string enc = pc.encrypt(strMessage);
			Assert.True(("q/xJqqN6qbiZMXYmiQC1Fw==").Equals(enc));
        }
开发者ID:stjom,项目名称:pubnub-api,代码行数:10,代码来源:EncryptionTests.cs

示例6: TestNullDecryption

        public void TestNullDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage = null;
            //decrypt
            string dec = pc.decrypt(strMessage);

            Assert.AreEqual("", dec);
        }
开发者ID:hart404,项目名称:pubnub-api,代码行数:10,代码来源:EncryptionTests.cs

示例7: TestGermanCharsDecryption

        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);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:12,代码来源:EncryptionTests.cs

示例8: TestArrayEncryption

        public void TestArrayEncryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //create an empty array object
            object[] objArr = { };
            //serialize
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strArr = js.Serialize(objArr);
            //Encrypt
            string enc = pc.encrypt(strArr);

            Assert.AreEqual("Ns4TB41JjT2NCXaGLWSPAQ==", enc);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:13,代码来源:EncryptionTests.cs

示例9: TestArrayDecryption

 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);
 }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:14,代码来源:EncryptionTests.cs

示例10: TestYayDecryption

        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));
        }
开发者ID:stjom,项目名称:pubnub-api,代码行数:15,代码来源:EncryptionTests.cs

示例11: TestYayEncryption

        public void TestYayEncryption ()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string strMessage= "yay!";
            //serialize the string
            //JavaScriptSerializer js = new JavaScriptSerializer();
            strMessage= JsonConvert.SerializeObject(strMessage);
            Console.WriteLine(strMessage);
            //Encrypt
            string enc = pc.encrypt(strMessage);
			Assert.True(("Wi24KS4pcTzvyuGOHubiXg==" ).Equals( enc));
            /*PubnubCrypto pc = new PubnubCrypto("enigma");
            string strMessage= "yay!";
            JavaScriptSerializer js = new JavaScriptSerializer();
            strMessage= js.Serialize(strMessage);
            string enc = pc.encrypt(strMessage);*/

            //Assert.AreEqual("q/xJqqN6qbiZMXYmiQC1Fw==", enc);
        }
开发者ID:stjom,项目名称:pubnub-api,代码行数:20,代码来源:EncryptionTests.cs

示例12: TestUnicodeCharsEncryption

        public void TestUnicodeCharsEncryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            string strMessage = "漢語";

            JavaScriptSerializer js = new JavaScriptSerializer();
            strMessage = js.Serialize(strMessage);
            Console.WriteLine(strMessage);
            string enc = pc.encrypt(strMessage);
            Console.WriteLine(enc);
            Assert.AreEqual("+BY5/miAA8aeuhVl4d13Kg==", enc);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:12,代码来源:EncryptionTests.cs

示例13: TestUnicodeCharsDecryption

        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);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:12,代码来源:EncryptionTests.cs

示例14: TestStuffCanEncryption

        public void TestStuffCanEncryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //input serialized string
            string strMessage = "{\"this stuff\":{\"can get\":\"complicated!\"}}";
            //encrypt
            string enc = pc.encrypt(strMessage);

            Assert.AreEqual("zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF", enc);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:10,代码来源:EncryptionTests.cs

示例15: TestPubNubEncryption2

        public void TestPubNubEncryption2()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //Deserialized
            string strMessage = "Pubnub Messaging API 2";
            //serialize the message
            JavaScriptSerializer js = new JavaScriptSerializer();
            strMessage = js.Serialize(strMessage);
            //encrypt
            string enc = pc.encrypt(strMessage);

            Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=", enc);
        }
开发者ID:netcon-source,项目名称:pubnub-api,代码行数:13,代码来源:EncryptionTests.cs


注:本文中的PubNub_Messaging.PubnubCrypto类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。