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


C# Core.PubnubCrypto类代码示例

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


PubnubCrypto类属于PubNubMessaging.Core命名空间,在下文中一共展示了PubnubCrypto类的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: 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

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

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

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

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

示例8: TestGermanCharsEncryption

        public void TestGermanCharsEncryption()
        {
            PubnubCrypto pc = new PubnubCrypto("enigma");
            string message = "ÜÖ";

            message = JsonConvert.SerializeObject(message);

            string encryptedMessage = pc.Encrypt(message);

            Assert.AreEqual("stpgsG1DZZxb44J7mFNSzg==", encryptedMessage);
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:11,代码来源:EncryptionTests.cs

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

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

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

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

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

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

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


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