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


C# PubnubCrypto.Encrypt方法代碼示例

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


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

示例1: TestNullEncryption

        public void TestNullEncryption()
        {

            bool isExpectedException = false;

            ThreadPool.QueueUserWorkItem((s) =>
                {
                    PubnubCrypto pc = new PubnubCrypto("enigma");
                    //serialized string
                    string message = null;

                    try
                    {
                        //Encrypt
                        string encryptedMessage = pc.Encrypt(message);
                    }
                    catch (ArgumentNullException)
                    {
                        isExpectedException = true;
                    }

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

示例2: TestYayEncryptionBasic

 public void TestYayEncryptionBasic ()
 {
     PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
     //deserialized string
     string message = "yay!";
     //Encrypt
     string encrypted = pubnubCrypto.Encrypt (message);
     Assert.True (("q/xJqqN6qbiZMXYmiQC1Fw==").Equals (encrypted));
 }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:9,代碼來源:EncryptionTests.cs

示例3: TestNullEncryption

 public void TestNullEncryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //serialized string
     string message = null;
     
     //encrypt
     string encryptedMessage = pc.Encrypt(message);
 }
開發者ID:Vlanta,項目名稱:c-sharp,代碼行數:9,代碼來源:EncryptionTests.cs

示例4: TestArrayEncryption

 public void TestArrayEncryption()
 {
     PubnubCrypto pc = new PubnubCrypto("enigma");
     //create an empty array object
     object[] emptyArray = { };
     //serialize
     string serializedArray = JsonConvert.SerializeObject(emptyArray);
     //Encrypt
     string encryptedMessage = pc.Encrypt(serializedArray);
     Assert.AreEqual("Ns4TB41JjT2NCXaGLWSPAQ==", encryptedMessage);
 }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:11,代碼來源:EncryptionTests.cs

示例5: TestYayEncryption

    public void TestYayEncryption ()
    {
      PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
      //deserialized string
      string message= "yay!";
      //serialize the string
      message = Common.Serialize(message);
      Console.WriteLine(message);
      //Encrypt
      string encrypted= pubnubCrypto.Encrypt(message);
	  Assert.True(("Wi24KS4pcTzvyuGOHubiXg==").Equals(encrypted));
    }
開發者ID:Evgeniy20,項目名稱:c-sharp,代碼行數:12,代碼來源:EncryptionTests.cs

示例6: TestYayEncryption

 public void TestYayEncryption ()
 {
     PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
     //deserialized string
     string message= "yay!";
     //serialize the string
     message= JsonConvert.SerializeObject(message);
     Console.WriteLine(message);
     //Encrypt
     string encrypted= pubnubCrypto.Encrypt(message);
     Assert.AreEqual("Wi24KS4pcTzvyuGOHubiXg==", encrypted);
 }
開發者ID:Vlanta,項目名稱:c-sharp,代碼行數:12,代碼來源:EncryptionTests.cs

示例7: TestArrayEncryption

 public void TestArrayEncryption()
 {
     ThreadPool.QueueUserWorkItem((s) =>
         {
             PubnubCrypto pc = new PubnubCrypto("enigma");
             //create an empty array object
             object[] emptyArray = { };
             //serialize
             string serializedArray = JsonConvert.SerializeObject(emptyArray);
             //Encrypt
             string encryptedMessage = pc.Encrypt(serializedArray);
             Deployment.Current.Dispatcher.BeginInvoke(() =>
                 {
                     Assert.AreEqual("Ns4TB41JjT2NCXaGLWSPAQ==", encryptedMessage);
                     TestComplete();
                 });
         });
 }
開發者ID:RecursosOnline,項目名稱:c-sharp,代碼行數:18,代碼來源:EncryptionTests.cs

示例8: TestNullEncryption

        public void TestNullEncryption()
        {

            bool isExpectedException = false;

            PubnubCrypto pc = new PubnubCrypto("enigma");
            //serialized string
            string message = null;

            try
            {
                //Encrypt
                string encryptedMessage = pc.Encrypt(message);
            }
            catch (ArgumentNullException)
            {
                isExpectedException = true;
            }

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

示例9: TestNullEncryption

        public void TestNullEncryption()
        {
			Debug.Log("Running TestNullEncryption()");
			bool isExpectedException = false;
			
            PubnubCrypto pc = new PubnubCrypto("enigma");
            //serialized string
            string message = null;

            try
            {
                //Encrypt
                pc.Encrypt(message);
            }
            catch (ArgumentNullException)
            {
                isExpectedException = true;
            }

            UUnitAssert.True(isExpectedException);

        }
開發者ID:Vlanta,項目名稱:c-sharp,代碼行數:22,代碼來源:EncryptionTests.cs

示例10: TestMyObjectEncryptionMiniJson

        //will fail with minijson
        //[Test]
        public void TestMyObjectEncryptionMiniJson ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            //create an object of the custom class
            CustomClass cc = new CustomClass ();
            //serialize it
            string result = Common.SerializeMiniJson (cc);
            //encrypt it
            string encrypted = pubnubCrypto.Encrypt (result);

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

示例11: TestObjectEncryptionMiniJson

        //will fail with minijson
        //[Test]
        public void TestObjectEncryptionMiniJson ()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto ("enigma");
            //create an object
            Object obj = new Object ();
            //serialize
            string strObj = Common.SerializeMiniJson (obj);
            //encrypt
            string encrypted = pubnubCrypto.Encrypt (strObj);

            Assert.True (("IDjZE9BHSjcX67RddfCYYg==").Equals (encrypted));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:14,代碼來源:EncryptionTests.cs

示例12: TestArrayEncryptionMiniJson

        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));
        }
開發者ID:eval01-tts,項目名稱:unity,代碼行數:11,代碼來源:EncryptionTests.cs

示例13: TestGermanCharsEncryptionJSONFx

        public void TestGermanCharsEncryptionJSONFx()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
            string message = "ÜÖ";
            message = Common.SerializeUsingJSONFx(message);
            Console.WriteLine(message);
            string encrypted = pubnubCrypto.Encrypt(message);
            Console.WriteLine(encrypted);

            Assert.AreEqual("stpgsG1DZZxb44J7mFNSzg==", encrypted);
        }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:11,代碼來源:EncryptionTests.cs

示例14: TestUnicodeCharsEncryptionJSONFx

 public void TestUnicodeCharsEncryptionJSONFx()
 {
     PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
     string message = "漢語";
     message = Common.SerializeUsingJSONFx(message);
     Console.WriteLine(message);
     string encrypted = pubnubCrypto.Encrypt(message);
     Console.WriteLine(encrypted);
     Assert.AreEqual("+BY5/miAA8aeuhVl4d13Kg==", encrypted);
 }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:10,代碼來源:EncryptionTests.cs

示例15: TestPubNubEncryption1JSONFX

        public void TestPubNubEncryption1JSONFX()
        {
            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma");
            //non serialized string
            string message = "Pubnub Messaging API 1";
            //serialize
            message = Common.SerializeUsingJSONFx(message);
            //encrypt
            string encrypted = pubnubCrypto.Encrypt(message);

            Assert.AreEqual("f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=", encrypted);
        }
開發者ID:jugalkishor-sujal,項目名稱:c-sharp,代碼行數:12,代碼來源:EncryptionTests.cs


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