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


C# PubnubCrypto.decrypt方法代码示例

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


在下文中一共展示了PubnubCrypto.decrypt方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: TestPubNubDecryption1

 public void TestPubNubDecryption1()
 {
     ThreadPool.QueueUserWorkItem((s) =>
         {
             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);
             //strMessage = JsonConvert.DeserializeObject<string>(dec);
             strMessage = (dec != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(dec) : "";
             Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     Assert.AreEqual("Pubnub Messaging API 1", strMessage);
                     TestComplete();
                 });
         });
 }
开发者ID:hart404,项目名称:pubnub-api,代码行数:21,代码来源:EncryptionTests.cs

示例8: TestStuffcanDecryption

 public void TestStuffcanDecryption()
 {
     ThreadPool.QueueUserWorkItem((s) =>
         {
             PubnubCrypto pc = new PubnubCrypto("enigma");
             //deserialized string
             string strMessage = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF";
             //decrypt
             string dec = pc.decrypt(strMessage);
             Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     Assert.AreEqual("{\"this stuff\":{\"can get\":\"complicated!\"}}", dec);
                     TestComplete();
                 });
         });
 }
开发者ID:hart404,项目名称:pubnub-api,代码行数:16,代码来源:EncryptionTests.cs

示例9: TestGermanCharsDecryption

        public void TestGermanCharsDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            string strMessage = "stpgsG1DZZxb44J7mFNSzg==";
            
            //decrypt
            string dec = pc.decrypt(strMessage);
            //deserialize
            strMessage = (dec != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(dec) : "";

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

示例10: TestUnicodeCharsDecryption

        public void TestUnicodeCharsDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            string strMessage = "+BY5/miAA8aeuhVl4d13Kg==";
            //decrypt
            string dec = pc.decrypt(strMessage);
            //deserialize
            strMessage = (dec != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(dec) : "";

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

示例11: TestHashDecryption

 public void TestHashDecryption()
 {
     ThreadPool.QueueUserWorkItem((s) =>
         {
             PubnubCrypto pc = new PubnubCrypto("enigma");
             //deserialized string
             string strMessage = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=";
             //decrypt
             string dec = pc.decrypt(strMessage);
             Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     Assert.AreEqual("{\"foo\":{\"bar\":\"foobar\"}}", dec);
                     TestComplete();
                 });
         });
 }
开发者ID:hart404,项目名称:pubnub-api,代码行数:16,代码来源:EncryptionTests.cs

示例12: TestPubNubDecryption2

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

示例13: TestObjectDecryption

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

示例14: 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= JsonConvert.DeserializeObject<string>(dec);

			Assert.True(("漢語").Equals(strMessage));
        }
开发者ID:stjom,项目名称:pubnub-api,代码行数:12,代码来源:EncryptionTests.cs

示例15: TestGermanCharsDecryption

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


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