コード例 #1
0
ファイル: FilesTest.cs プロジェクト: cjmcassar/IxDAndroid
        public void TestFileDecryption()
        {
            PNConfiguration pnConfiguration = new PNConfiguration();

            pnConfiguration.Origin           = EditorCommon.Origin;
            pnConfiguration.SubscribeKey     = EditorCommon.SubscribeKey;
            pnConfiguration.PublishKey       = EditorCommon.PublishKey;
            pnConfiguration.CipherKey        = "enigma";
            pnConfiguration.LogVerbosity     = PNLogVerbosity.BODY;
            pnConfiguration.PresenceTimeout  = 60;
            pnConfiguration.PresenceInterval = 30;

            PubNubUnity pnUnity = new PubNubUnity(pnConfiguration, null, null);

            PubnubCrypto pubnubCrypto = new PubnubCrypto("enigma", PNLog);
            string       filePath     = "Assets/PubNub/PlayModeTests/file_upload_test.txt";
            string       fileEncPath  = "Assets/PubNub/PlayModeTests/file_upload_sample_encrypted.txt";
            string       savePath     = string.Format("{0}/test.dl.enc.txt", Application.temporaryCachePath);

            pubnubCrypto.DecryptFile(fileEncPath, savePath);

            string read = System.IO.File.ReadAllText(filePath);
            string save = System.IO.File.ReadAllText(savePath);

            Assert.True(read.Equals(save));
        }