當前位置: 首頁>>代碼示例>>C#>>正文


C# PubnubCrypto.Decrypt方法代碼示例

本文整理匯總了C#中PubNubMessaging.Core.PubnubCrypto.Decrypt方法的典型用法代碼示例。如果您正苦於以下問題:C# PubnubCrypto.Decrypt方法的具體用法?C# PubnubCrypto.Decrypt怎麽用?C# PubnubCrypto.Decrypt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PubNubMessaging.Core.PubnubCrypto的用法示例。


在下文中一共展示了PubnubCrypto.Decrypt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestNullDecryption

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

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            //Assert.AreEqual("", dec);
                            Assert.IsTrue(isExpectedException);
                            TestComplete();
                        });
                });
        }
開發者ID:hellogurus,項目名稱:pubnub-api,代碼行數:27,代碼來源:EncryptionTests.cs

示例2: TestYayDecryptionBasic

        public void TestYayDecryptionBasic ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            string message = "q/xJqqN6qbiZMXYmiQC1Fw==";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt (message);

            Assert.True (("yay!").Equals (decrypted));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:9,代碼來源:EncryptionTests.cs

示例3: TestYayDecryptionBasic

 public void TestYayDecryptionBasic()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     string message = "q/xJqqN6qbiZMXYmiQC1Fw==";
     //decrypt
     string decryptedMessage = pc.Decrypt(message);
     //deserialize again
     Assert.AreEqual("yay!", decryptedMessage);
 }
開發者ID:hellogurus,項目名稱:pubnub-api,代碼行數:9,代碼來源:EncryptionTests.cs

示例4: TestGermanCharsDecryption

 public void TestGermanCharsDecryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     string message = "stpgsG1DZZxb44J7mFNSzg==";
     //Decrypt
     string decryptedMessage = pc.Decrypt(message);
     //deserialize
     message = (decryptedMessage != "**DECRYPT ERROR**") ? JsonConvert.DeserializeObject<string>(decryptedMessage) : "";
     Assert.AreEqual("ÜÖ", message);
 }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:10,代碼來源:EncryptionTests.cs

示例5: TestNullDecryption

        public void TestNullDecryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string message = null;
            //decrypt
            string decryptedMessage = pc.Decrypt(message);

            Assert.AreEqual("", decryptedMessage);
        }
開發者ID:hellogurus,項目名稱:pubnub-api,代碼行數:10,代碼來源:EncryptionTests.cs

示例6: TestArrayDecryption

 public void TestArrayDecryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //Input the deserialized string
     string message = "Ns4TB41JjT2NCXaGLWSPAQ==";
     //Decrypt
     string decryptedMessage = pc.Decrypt(message);
     //create a serialized object
     object[] emptyArrayObject = { };
     string result = JsonConvert.SerializeObject(emptyArrayObject);
     //compare the serialized object and the return of the Decrypt method
     Assert.AreEqual(result, decryptedMessage);
 }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:13,代碼來源:EncryptionTests.cs

示例7: TestYayDecryption

 public void TestYayDecryption ()
 {
     PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
     //Non deserialized string
     string message= "\"Wi24KS4pcTzvyuGOHubiXg==\"";
     //Deserialize 
     message= JsonConvert.DeserializeObject<string>(message);
     //decrypt
     string decrypted= pubnubCrypto.Decrypt(message);
     //deserialize again
     message= JsonConvert.DeserializeObject<string>(decrypted);
     Assert.AreEqual("yay!", message);
 }
開發者ID:Vlanta,項目名稱:c-sharp,代碼行數:13,代碼來源:EncryptionTests.cs

示例8: TestYayDecryptionMiniJson

        public void TestYayDecryptionMiniJson ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            //Non deserialized string
            string message = "\"Wi24KS4pcTzvyuGOHubiXg==\"";

            //Deserialize 
            message = Common.DeserializeMiniJson<string> (message);

            //decrypt
            string decrypted = pubnubCrypto.Decrypt (message);
            //deserialize again
            message = Common.DeserializeMiniJson<string> (decrypted);
            Assert.True (("yay!").Equals (message));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:15,代碼來源:EncryptionTests.cs

示例9: TestNullDecryption

        public void TestNullDecryption()
        {
            bool isExpectedException = false;
            string decryptedMessage = "";
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //deserialized string
            string message = null;
            try
            {
                //Decrypt
                decryptedMessage = pc.Decrypt(message);
            }
            catch (ArgumentNullException)
            {
                isExpectedException = true;
            }

            Assert.IsTrue(isExpectedException);
        }
開發者ID:pubnub,項目名稱:c-sharp,代碼行數:19,代碼來源:EncryptionTests.cs

示例10: TestArrayDecryption

 public void TestArrayDecryption()
 {
     ThreadPool.QueueUserWorkItem((s) =>
         {
             PubnubCrypto pc = new PubnubCrypto("enigma");
             //Input the deserialized string
             string message = "Ns4TB41JjT2NCXaGLWSPAQ==";
             //Decrypt
             string decryptedMessage = pc.Decrypt(message);
             //create a serialized object
             object[] emptyArrayObject = { };
             string result = JsonConvert.SerializeObject(emptyArrayObject);
             //compare the serialized object and the return of the Decrypt method
             Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     Assert.AreEqual(result, decryptedMessage);
                     TestComplete();
                 });
         });
 }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:20,代碼來源:EncryptionTests.cs

示例11: TestHashDecryption

        public void TestHashDecryption ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            //deserialized string
            string message = "GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt (message);

            Assert.True (("{\"foo\":{\"bar\":\"foobar\"}}").Equals (decrypted));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:10,代碼來源:EncryptionTests.cs

示例12: TestPubNubDecryption1MiniJson

 public void TestPubNubDecryption1MiniJson ()
 {
     PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
     //deserialized string
     string message = "f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=";
     //decrypt
     string decrypted = pubnubCrypto.Decrypt (message);
     //deserialize
     message = Common.DeserializeMiniJson<string> (decrypted);
     Assert.True (("Pubnub Messaging API 1").Equals (message));
 }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:11,代碼來源:EncryptionTests.cs

示例13: TestStuffcanDecryption

        public void TestStuffcanDecryption ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            //deserialized string
            string message = "zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF";
            //decrypt
            string decrypted = pubnubCrypto.Decrypt (message);

            Assert.True (("{\"this stuff\":{\"can get\":\"complicated!\"}}").Equals (decrypted));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:10,代碼來源:EncryptionTests.cs

示例14: TestMyObjectDecryptionMiniJson

        //will fail with minijson
        //[Test]
        public void TestMyObjectDecryptionMiniJson ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            //Deserialized
            string message = "Zbr7pEF/GFGKj1rOstp0tWzA4nwJXEfj+ezLtAr8qqE=";
            //Decrypt
            string decrypted = pubnubCrypto.Decrypt (message);
            //create an object of the custom class
            CustomClass cc = new CustomClass ();
            //Serialize it
            string result = Common.SerializeMiniJson (cc);

            UnityEngine.Debug.Log ("decrypted:" + decrypted);
            UnityEngine.Debug.Log ("result:" + result);
            Assert.True ((decrypted).Equals (result));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:18,代碼來源:EncryptionTests.cs

示例15: TestPubNubDecryption2MiniJson

 public void TestPubNubDecryption2MiniJson ()
 {
     PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
     //Deserialized string    
     string message = "f42pIQcWZ9zbTbH8cyLwB/tdvRxjFLOYcBNMVKeHS54=";
     //Decrypt
     string decrypted = pubnubCrypto.Decrypt (message);
     //Deserialize
     message = Common.DeserializeMiniJson<string> (decrypted);
     Assert.True (("Pubnub Messaging API 2").Equals (message));
 }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:11,代碼來源:EncryptionTests.cs


注:本文中的PubNubMessaging.Core.PubnubCrypto.Decrypt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。