Chat Refactor (#79) [TGSDeploy]

* Chat refactor: Service changes

* Settings migration

* First pass at implementing the commandline

* WIP irc modes

* Wip

* Fix it

* Working

* Fix dickscord

* Some readme updates

* Fixes

* PMs are admin etc

* Compiling

* Final touches

* Version bump to 3.0.86.0
This commit is contained in:
Jordan Brown
2017-06-28 14:18:59 -04:00
committed by GitHub
parent e989d7b356
commit fb432c8fc3
29 changed files with 1385 additions and 887 deletions
+20
View File
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace TGServerService
{
@@ -45,6 +47,24 @@ namespace TGServerService
}
}
public static string EncryptData(byte[] data, out string sentropy)
{
// Generate additional entropy (will be used as the Initialization vector)
byte[] entropy = new byte[20];
using (var rng = new RNGCryptoServiceProvider())
rng.GetBytes(entropy);
byte[] ciphertext = ProtectedData.Protect(data, entropy, DataProtectionScope.CurrentUser);
sentropy = Convert.ToBase64String(entropy, 0, entropy.Length);
return Convert.ToBase64String(ciphertext, 0, ciphertext.Length);
}
public static byte[] DecryptData(string data, string entropy)
{
return ProtectedData.Unprotect(Convert.FromBase64String(data), Convert.FromBase64String(entropy), DataProtectionScope.CurrentUser);
}
public static void CopyDirectory(string sourceDirName, string destDirName, IList<string> ignore = null, bool ignoreIfNotExists = false)
{
// If the destination directory doesn't exist, create it.