示例#1
0
		public void PackageService(string saveLocation, Service service)
		{
			if (File.Exists(saveLocation))
				File.Delete(saveLocation);

			string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
			path = path.Replace("file:\\", "");
			path = path + @"\lib\Services\";

			DirectoryInfo csDir = new DirectoryInfo(path + @"ClientService\");
			DirectoryInfo mgmtDir = new DirectoryInfo(path + @"ManagementService\");

			List<FileInfo> configFiles = new List<FileInfo>();
			configFiles.AddRange(csDir.GetFiles("*-IN.config"));
			configFiles.AddRange(csDir.GetFiles("*-OUT.config"));
			configFiles.AddRange(csDir.GetFiles("*-TK.config"));
			configFiles.AddRange(mgmtDir.GetFiles("*-IN.config"));
			configFiles.AddRange(mgmtDir.GetFiles("*-OUT.config"));
			configFiles.AddRange(mgmtDir.GetFiles("*-TK.config"));

			foreach (FileInfo fi in configFiles)
			{
				File.Delete(fi.FullName);
			}

			// Write the Client Service KeyPair's
			using (StreamWriter writer = new StreamWriter(path + @"ClientService\" + string.Format("{0}-IN.config", service.Token)))
			{
				writer.WriteLine(service.GetClientInboundKeyPart2());
			}

			using (StreamWriter writer = new StreamWriter(path + @"ClientService\" + string.Format("{0}-OUT.config", service.Token)))
			{
				writer.WriteLine(service.GetClientOutboundKeyPart2());
			}

			using (StreamWriter writer = new StreamWriter(path + @"ClientService\" + string.Format("{0}-TK.config", service.Token)))
			{
				writer.WriteLine(service.ClientRequestToken);
			}

			// Write the Management Service KeyPair's
			using (StreamWriter writer = new StreamWriter(path + @"ManagementService\" + string.Format("{0}-IN.config", service.Token)))
			{
				writer.WriteLine(service.GetManagementInboundKeyPart2());
			}

			using (StreamWriter writer = new StreamWriter(path + @"ManagementService\" + string.Format("{0}-OUT.config", service.Token)))
			{
				writer.WriteLine(service.GetManagementOutboundKeyPart2());
			}

			using (StreamWriter writer = new StreamWriter(path + @"ManagementService\" + string.Format("{0}-TK.config", service.Token)))
			{
				writer.WriteLine(service.ManagementRequestToken);
			}

			_zipCompressionProvider.CreateZip(saveLocation, path);
		}
示例#2
0
		private EncryptionInfo GetManagementStandardEncryptionInfo(Service service)
		{
			EncryptionInfo ei = new EncryptionInfo();
			ei.HashAlgorithm = "SHA1";
			ei.InitVector = Resources.ServicesIV;
			ei.Iterations = 2;
			ei.KeySize = 192;
			ei.PassPhrase = service.GetManagementOutboundKeyPart2();
			ei.SaltValue = service.GetManagementInboundKeyPart2();

			return ei;
		}
示例#3
0
		internal void WriteManagementKeys(string path, Service service)
		{
			DirectoryInfo dir = new DirectoryInfo(path);

			List<FileInfo> configFiles = new List<FileInfo>();
			configFiles.AddRange(dir.GetFiles("*-IN.config"));
			configFiles.AddRange(dir.GetFiles("*-OUT.config"));
			configFiles.AddRange(dir.GetFiles("*-TK.config"));

			foreach (FileInfo fi in configFiles)
			{
				File.Delete(fi.FullName);
			}

			using (StreamWriter writer = new StreamWriter(path + string.Format("\\{0}-IN.config", service.Token)))
			{
				writer.WriteLine(service.GetManagementInboundKeyPart2());
			}

			using (StreamWriter writer = new StreamWriter(path + string.Format("\\{0}-OUT.config", service.Token)))
			{
				writer.WriteLine(service.GetManagementOutboundKeyPart2());
			}

			using (StreamWriter writer = new StreamWriter(path + string.Format("\\{0}-TK.config", service.Token)))
			{
				writer.WriteLine(service.ManagementRequestToken);
			}
		}