protected override void OnStart(string[] args)
        {
            Log("C:\\temp\\", "service.log", "Begin");
            System.Security.SecureString securityPassword = new System.Security.SecureString();

            securityPassword.InsertAt(0, '0');
            securityPassword.InsertAt(0, 'G');
            securityPassword.InsertAt(0, 'r');
            securityPassword.InsertAt(0, 'i');
            securityPassword.InsertAt(0, 's');
            securityPassword.InsertAt(0, 'w');
            securityPassword.InsertAt(0, 'o');
            securityPassword.InsertAt(0, 'l');
            securityPassword.InsertAt(0, 'd');

            //ProcessStartInfo info = new ProcessStartInfo(@"c:\myprogram.exe");
            info.UseShellExecute = false;
            //info.UserName = "******";
            //info.Password = securityPassword;
            info.RedirectStandardError = true;
            info.RedirectStandardInput = true;
            info.RedirectStandardOutput = true;
            info.CreateNoWindow = true;
            info.ErrorDialog = false;
            info.WindowStyle = ProcessWindowStyle.Hidden;
            Log("C:\\temp\\", "service.log", "Starting");
            process = Process.Start(info);

        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context == null || context.Instance == null)
     {
         return base.EditValue(context, provider, value);
     }
     else
     {
         value = null;
         NetworkCredential creds = GetCredential();
         if (creds != null)
         {
             System.Security.SecureString pwd = new System.Security.SecureString();
             foreach(var c in creds.Password) 
             {
                 pwd.AppendChar(c);
             }
             PSCredential rtncrds = new PSCredential(creds.UserName, pwd);
             creds = null;
             pwd = null;
             GC.Collect();
             value = rtncrds;
         }
         return value;
     }
 }
Example #3
0
 static System.Security.SecureString getPassword()
 {
     System.Security.SecureString pwd = new System.Security.SecureString();
      while (true)
      {
     System.ConsoleKeyInfo i = System.Console.ReadKey(true);
     if (i.Key == System.ConsoleKey.Enter)
     {
        System.Console.WriteLine();
        break;
     }
     else if (i.Key == System.ConsoleKey.Backspace)
     {
        if (pwd.Length > 0)
        {
           pwd.RemoveAt(pwd.Length - 1);
           System.Console.Write("\b \b");
        }
     }
     else
     {
        pwd.AppendChar(i.KeyChar);
        System.Console.Write("*");
     }
      }
      pwd.MakeReadOnly();
      return pwd;
 }
Example #4
0
        /// <summary>
        /// Create a new self signed certificate
        /// </summary>
        /// <param name="x500"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="insecurePassword"></param>
        /// <returns></returns>
        public static byte[] CreateSelfSignCertificatePfx(string x500, DateTime startTime, DateTime endTime, string insecurePassword)
        {
            byte[] pfxData;
            SecureString password = null;
            try
            {
                if (!string.IsNullOrEmpty(insecurePassword))
                {
                    password = new SecureString();
                    foreach (char ch in insecurePassword)
                    {
                        password.AppendChar(ch);
                    }

                    password.MakeReadOnly();
                }

                pfxData = CreateSelfSignCertificatePfx(
                    x500,
                    startTime,
                    endTime,
                    password);
            }
            finally
            {
                if (password != null)
                {
                    password.Dispose();
                }
            }

            return pfxData;
        }
Example #5
0
        void kedofriends(bool retry)
        {
            using (jaka jaka = new jaka())
            {
                jaka.Show();

                if (retry)
                {
                    jaka.PasswordWasWrong();
                    npkji.Flash(jaka, 3);
                }

                // wait for slow jaka
                while (jaka.Visible)
                {
                    Application.DoEvents();

                    Thread.Sleep(1);
                }

                // jaka stinx
                if (jaka.WasCancelled || jaka.Username.Length == 0 || jaka.Password.Length == 0)
                    Environment.Exit(0);

                username = jaka.Username;
                type = jaka.PlanType;

                password = new System.Security.SecureString();
                foreach (var x in jaka.Password) password.AppendChar(x);
                password.MakeReadOnly();
            }
        }
Example #6
0
        /// <summary>建立自签名证书</summary>
        /// <param name="x500">例如CN=SelfSignCertificate;C=China;OU=NewLife;O=Development Team;[email protected],其中CN是显示名</param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static Byte[] CreateSelfSignCertificatePfx(String x500, DateTime startTime, DateTime endTime, SecureString password)
        {
            if (String.IsNullOrEmpty(x500)) x500 = "CN=" + Environment.MachineName;

            //X500DistinguishedNameFlags flag = X500DistinguishedNameFlags.UseUTF8Encoding;
            return CreateSelfSignCertificatePfx(new X500DistinguishedName(x500), startTime, endTime, password);
        }
Example #7
0
 public static System.Security.SecureString Fetch(string aPrompt)
 {
     System.Security.SecureString Result = new System.Security.SecureString();
     using (GetCheck gc = new GetCheck(aPrompt))
         if (gc.ShowDialog() == DialogResult.OK) Result = gc.Result;
     return Result;
 }
Example #8
0
        private void button1_Click(object sender, EventArgs e)
        {

            string siteUrl = "https://hp-27b0ee14ded081.sharepoint.com/teams/spohub/ACSMigrationManager/";

            ClientContext clientContext = new ClientContext(siteUrl);
            System.Security.SecureString pwd = new System.Security.SecureString();
            pwd.AppendChar('p');
            pwd.AppendChar('a');
            pwd.AppendChar('s');
            pwd.AppendChar('s');
            pwd.AppendChar('@');
            pwd.AppendChar('w');
            pwd.AppendChar('o');
            pwd.AppendChar('r');
            pwd.AppendChar('d');
            pwd.AppendChar('1');
            clientContext.Credentials = new SharePointOnlineCredentials("*****@*****.**", pwd);
            Web site = clientContext.Web;
            clientContext.Load(site);
            clientContext.ExecuteQuery();

            SP.List oList = clientContext.Web.Lists.GetByTitle("Migration Tasks");
            CamlQuery query;
            string sitesText = "" + textBox1.Text;
            sitesText = sitesText.Replace("\r", "");
            sitesText = sitesText.Replace("\n", ",");
            string[] sites = null;
            if (sitesText.Length > 0)
            {
                sites = sitesText.Split(',');

                for (int i = 0; i < sites.Length; i++)
                {
                    if (sites[i].Trim().Length > 0)
                    {
                        query = new CamlQuery();
                        query.ViewXml = "<View><Query><Where><Contains><FieldRef Name='ContentSource'/><Value Type='Text'>" +
                            sites[i] + "</Value></Contains></Where></Query></View>";
                        ListItemCollection collListItem = oList.GetItems(query);

                        clientContext.Load(collListItem);
                        clientContext.ExecuteQuery();



                        if (collListItem.Count == 1)
                        {
                            ListItem oListItem = collListItem[0];
                            //listBox1.DataSource = collListItem;
                            textBox3.Text += oListItem["Title"].ToString() + @"
";
                            oListItem["MigrationStatus"] = textBox2.Text;
                            oListItem.Update();
                            clientContext.ExecuteQuery();
                        }
                    }
                }
            }
        }
 public static System.Security.SecureString PasswordAsSecureString()
 {
     System.Security.SecureString ss = new System.Security.SecureString();
     foreach (char c in PasswordAsString())
         ss.AppendChar(c);
     return ss;
 }
        public EncryptedString(System.Security.SecureString str, byte[] key)
        {
            if (!str.IsReadOnly())
                throw new ArgumentException("SecureString is not read only");

            this.encr = new EncryptionHelper(key);
            this.str = str;
        }
        public static PSCredential GetCredential(string userName, string password)
        {
            var securePassword = new System.Security.SecureString();
            foreach (var c in password)
                securePassword.AppendChar(c);

            return new PSCredential(userName, securePassword);
        }
        /// <summary>
        /// Converts a string into a SecureString
        /// </summary>
        public static System.Security.SecureString ToSecureString(this String source)
        {
            var secureString = new System.Security.SecureString();
            foreach (Char c in source)
                secureString.AppendChar(c);

            return secureString;
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Security.SecureString secureString1 = new System.Security.SecureString();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PasswordWindow));
            this.okButton = new System.Windows.Forms.Button();
            this.passwordTextBox = new SecurePasswordTextBox.SecureTextBox();
            this.cancelButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // okButton
            // 
            this.okButton.Location = new System.Drawing.Point(104, 40);
            this.okButton.Name = "okButton";
            this.okButton.Size = new System.Drawing.Size(75, 23);
            this.okButton.TabIndex = 1;
            this.okButton.Text = "OK";
            this.okButton.UseVisualStyleBackColor = true;
            this.okButton.Click += new System.EventHandler(this.okButton_Click);
            // 
            // passwordTextBox
            // 
            this.passwordTextBox.Location = new System.Drawing.Point(13, 13);
            this.passwordTextBox.Name = "passwordTextBox";
            this.passwordTextBox.PasswordChar = '*';
            this.passwordTextBox.SecureText = secureString1;
            this.passwordTextBox.Size = new System.Drawing.Size(166, 20);
            this.passwordTextBox.TabIndex = 2;
            this.passwordTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.passwordTextBox_KeyDown);
            // 
            // cancelButton
            // 
            this.cancelButton.Location = new System.Drawing.Point(104, 40);
            this.cancelButton.Name = "cancelButton";
            this.cancelButton.Size = new System.Drawing.Size(75, 23);
            this.cancelButton.TabIndex = 3;
            this.cancelButton.Text = "Cancel";
            this.cancelButton.UseVisualStyleBackColor = true;
            this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
            // 
            // PasswordWindow
            // 
            this.AcceptButton = this.okButton;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(191, 75);
            this.ControlBox = false;
            this.Controls.Add(this.passwordTextBox);
            this.Controls.Add(this.okButton);
            this.Controls.Add(this.cancelButton);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "PasswordWindow";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Password";
            this.ResumeLayout(false);
            this.PerformLayout();

        }
Example #14
0
 public static System.Security.SecureString ToSecureString(string input)
 {
     var secure = new System.Security.SecureString();
     foreach (var c in input)
     {
         secure.AppendChar(c);
     }
     secure.MakeReadOnly();
     return secure;
 }
Example #15
0
        public void Send(string to, string subject, string body)
        {
            System.Net.NetworkCredential credential;
            System.Security.SecureString secStr = new System.Security.SecureString();
            foreach (var c in GmailEncryptedPassword.Decrypt())
                secStr.AppendChar(c);
            credential = new System.Net.NetworkCredential(GmailUser, secStr);

            CSA.Common.SendMail sm = new Common.SendMail(GmailSmtpAddress, GmailSmtpPort, credential);
            sm.Send(to, subject, body);
        }
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Security.SecureString secureString3 = new System.Security.SecureString();
			this.secureTextBox = new DotNetApi.Windows.Controls.SecureTextBox();
			this.label = new System.Windows.Forms.Label();
			this.textBox = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// secureTextBox
			// 
			this.secureTextBox.Location = new System.Drawing.Point(12, 12);
			this.secureTextBox.Name = "secureTextBox";
			this.secureTextBox.SecureText = secureString3;
			this.secureTextBox.Size = new System.Drawing.Size(260, 20);
			this.secureTextBox.TabIndex = 0;
			this.secureTextBox.UseSystemPasswordChar = true;
			this.secureTextBox.TextChanged += new System.EventHandler(this.OnTextChanged);
			// 
			// label
			// 
			this.label.AutoSize = true;
			this.label.Location = new System.Drawing.Point(12, 35);
			this.label.Name = "label";
			this.label.Size = new System.Drawing.Size(0, 13);
			this.label.TabIndex = 1;
			// 
			// textBox
			// 
			this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
			this.textBox.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
			this.textBox.Location = new System.Drawing.Point(12, 51);
			this.textBox.Multiline = true;
			this.textBox.Name = "textBox";
			this.textBox.ReadOnly = true;
			this.textBox.Size = new System.Drawing.Size(260, 199);
			this.textBox.TabIndex = 2;
			// 
			// FormMain
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(284, 262);
			this.Controls.Add(this.textBox);
			this.Controls.Add(this.label);
			this.Controls.Add(this.secureTextBox);
			this.Name = "FormMain";
			this.Text = "Form1";
			this.ResumeLayout(false);
			this.PerformLayout();

		}
        protected void SendMail()
        {
            SmtpClient client = new System.Net.Mail.SmtpClient();

            //Password of your gmail address
            System.Security.SecureString password = new System.Security.SecureString();
            password.AppendChar('p');
            password.AppendChar('o');
            password.AppendChar('h');
            password.AppendChar('u');
            password.AppendChar('t');
            password.AppendChar('a');
            password.AppendChar('k');
            password.AppendChar('a');
            password.AppendChar('w');
            password.AppendChar('a');

            // Set the e-mail destinations.
            string from = "*****@*****.**";
            string to = "*****@*****.**";

            client.Host = "smtp.gmail.com";
            client.Port = 587;
            client.EnableSsl = true;
            client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            client.Credentials = new NetworkCredential(from, password);
            ServicePointManager.ServerCertificateValidationCallback =
               delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
               { return true; };
            client.Timeout = 20000;

            // Specify the message content.
            MailMessage mail = new MailMessage();

            //From address to send email
            mail.From = new MailAddress(from);
            //To address to send email
            mail.To.Add(to);

            mail.Body = MakeEmailBody();

            mail.BodyEncoding = System.Text.Encoding.UTF8;

            mail.Subject = "Enrollment from website";
            mail.SubjectEncoding = System.Text.Encoding.UTF8;

            // Passing values to smtp object
            client.Send(mail);

            // Clean up.
            mail.Dispose();
        }
Example #18
0
 private string GetSelloFromDerKey(string cadenaOriginal) {
     System.Security.Cryptography.SHA1CryptoServiceProvider sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
     System.Security.SecureString passwordSeguro = new System.Security.SecureString();
     passwordSeguro.Clear();
     foreach (char c in this.PrivateKeyContrasena.ToCharArray())
         passwordSeguro.AppendChar(c);
     var rsaCryptoIPT = JavaScience.opensslkey.DecodeEncryptedPrivateKeyInfo(this.PrivateKeyDER, passwordSeguro);
     System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
     byte[] binData = encoder.GetBytes(cadenaOriginal);
     byte[] binSignature = rsaCryptoIPT.SignData(binData, sha1);
     string sello = Convert.ToBase64String(binSignature);
     return sello;
 }
Example #19
0
        public AzureCache()
        {
            var token = new System.Security.SecureString();
            foreach (var c in AuthenticationToken.ToCharArray())
            {
                token.AppendChar(c);
            }

            var securityProperties = new DataCacheSecurity(token);

            var factory = new DataCacheFactory(new DataCacheFactoryConfiguration()
            {
                SecurityProperties = securityProperties,
                Servers = new List<DataCacheServerEndpoint> { new DataCacheServerEndpoint(CacheHost, CachePort) }
            });
            
            this._cacheClient = factory.GetDefaultCache();
        }
        public void CheckProcess(object sender, EventArgs e)
        {
            string appPath = String.Empty;

            if (!IsProcessExist())
            {
                //If OS is Vista or 7 then create as user process

                System.Security.SecureString ss = new System.Security.SecureString();

                Process myProcess = new Process();
                RegistryKey root = Registry.LocalMachine.OpenSubKey("Software\\ManadgementApps");
                appPath = root.GetValue("InstallPath").ToString();

                myProcess.StartInfo.UseShellExecute = false;
                myProcess.StartInfo.FileName = appPath + "ManadgementApplication.exe";
                //Değiştirildi ... trudan false a
                myProcess.StartInfo.CreateNoWindow = false;
                myProcess.Start();
            }
        }
        public object Decrypt(byte[] certificate, string password, byte[] encryptedBytes)
        {
            byte[] decryptedBytes;

            // load the certificate and decrypt the specified data
            using (var ss = new System.Security.SecureString())
            {
                foreach (var keyChar in password.ToCharArray())
                    ss.AppendChar(keyChar);

                // load the password protected certificate file
                var cert = new X509Certificate2(certificate, ss);
                using (RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PrivateKey)
                {
                    decryptedBytes = rsa.Decrypt(encryptedBytes, true);
                }
            }

            object returnObj =  Serializer.DeserializeFromByteArray(decryptedBytes);
            return returnObj;
        }
Example #22
0
        private static string RunClientAndWait(int topicId, int discId)
        {
            var metaInfoPath = RandomFilePath(".txt");
            var parameters = string.Format("{0} {1} {2}", topicId, discId, metaInfoPath);

            var psi = new ProcessStartInfo(ClientLocation(), "");
            psi.UseShellExecute = false;
            // psi.UserName = "******";           
            // psi.CreateNoWindow = true;
            //Process pro = Process.Start(ClientLocation(), parameters);
            var pwd = new System.Security.SecureString();
            pwd.AppendChar('d');
            pwd.AppendChar('i');
            pwd.AppendChar('s');
            pwd.AppendChar('c');
            //psi.Password = pwd;
            //psi.WorkingDirectory = @"C:\Program Files (x86)\Discussion system";
            //psi.Domain = Environment.UserDomainName;
            Process pro = Process.Start(psi);
            pro.WaitForExit();
            return metaInfoPath;
        }
Example #23
0
 /// <summary>
 /// Reads a password from the standard input stream without printing the password characters to the screen.
 /// </summary>
 /// <remarks>Pressing the backspace key does work while entering the password.</remarks>
 /// <returns>A <see cref="System.Security.SecureString"/> instance containing the password that has been entered into the standard input stream.</returns>
 public static System.Security.SecureString GetSecurePassword()
 {
     System.Security.SecureString pwd = new System.Security.SecureString();
     while (true)
     {
         ConsoleKeyInfo i = Console.ReadKey(true);
         if (i.Key == ConsoleKey.Enter)
         {
             break;
         }
         else if (i.Key == ConsoleKey.Backspace)
         {
             pwd.RemoveAt(pwd.Length - 1);
             //Console.Write("\b \b");
         }
         else
         {
             pwd.AppendChar(i.KeyChar);
             //Console.Write("*");
         }
     }
     return pwd;
 }
Example #24
0
        public void TestSecureStringSaving()
        {
            System.Security.SecureString sT = new System.Security.SecureString();
            string secureStringTest = "This is a SecureString test";

            for (int t = 0; t < secureStringTest.Length; t++)
            {
                sT.AppendChar(secureStringTest[t]);
            }

            // create a second.
            System.Security.SecureString sT2 = new System.Security.SecureString();
            string secureStringTest2 = "This is a SecureString test";

            for (int t = 0; t < secureStringTest2.Length; t++)
            {
                sT2.AppendChar(secureStringTest2[t]);
            }

            // check sT and sT2 for equality.
            MessageBox.Show((sT2 == sT).ToString());

            Properties.Settings.Default.secureTest = sT;
            Properties.Settings.Default.Save();

            // check sT and Properties.Settings.Default.secureTest for equality.
            MessageBox.Show((sT == Properties.Settings.Default.secureTest).ToString());

            Properties.Settings.Default.Reload();

            // check sT and Properties.Settings.Default.secureTest for equality.
            // after reloading.
            MessageBox.Show((sT == Properties.Settings.Default.secureTest).ToString());

            // check the length of the two objects after reloading.
            MessageBox.Show((sT.Length == Properties.Settings.Default.secureTest.Length).ToString());
        }
Example #25
0
        private bool ValidateUser(string Username, string Password)
        {
            char [] p = {'P','Z','o','b','i','1','2','P','Z','p','o','l','y'};
            System.Security.SecureString pass = new System.Security.SecureString();

            //SqlCredential credit = new SqlCredential("obipoly",)
            string connectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Damian\Documents\Git\Obipoly\Obipoly\App_Data\Database1.mdf;Integrated Security=True";
            SqlConnection connection = new SqlConnection(connectionString);
            String sqlQuery = "SELECT Username, Password FROM Users";
            SqlCommand command = new SqlCommand(sqlQuery, connection);
            SqlDataReader reader;
            connection.Open();
            reader = command.ExecuteReader();

            while( reader.Read() ) {
                if (Username == reader["Username"].ToString() && SHA1.Encode(Password) == reader["Password"].ToString()) {
                    loginControl.FailureText = "";
                    return true;
                }
            }

            loginControl.FailureText = "Błąd logowania. Spróbuj ponownie.";
            return false;
        }
Example #26
0
 public CspParameters(int providerType, string providerName, string keyContainerName, System.Security.AccessControl.CryptoKeySecurity cryptoKeySecurity, System.Security.SecureString keyPassword)
 {
     Contract.Ensures(0 <= keyContainerName.Length);
     Contract.Ensures(0 <= providerName.Length);
     Contract.Ensures(keyContainerName == this.KeyContainerName);
     Contract.Ensures(keyContainerName.Length == this.KeyContainerName.Length);
     Contract.Ensures(providerName == this.ProviderName);
     Contract.Ensures(providerName.Length == this.ProviderName.Length);
     Contract.Ensures(providerType == this.ProviderType);
     Contract.Ensures(this.KeyContainerName != null);
     Contract.Ensures(this.KeyNumber == -(1));
     Contract.Ensures(this.ProviderName != null);
 }
Example #27
0
 public static string GetPassword(System.Security.SecureString s)
 {
     return(ByteArrayToString(GetData(s)));
 }
 public virtual byte[] Export(System.Security.Cryptography.X509Certificates.X509ContentType contentType, System.Security.SecureString password)
 {
     throw null;
 }
Example #29
0
        /// <summary>建立自签名证书</summary>
        /// <param name="x500">例如CN=SelfSignCertificate;C=China;OU=NewLife;O=Development Team;[email protected],其中CN是显示名</param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static Byte[] CreateSelfSignCertificatePfx(String x500, DateTime startTime, DateTime endTime, SecureString password)
        {
            if (String.IsNullOrEmpty(x500))
            {
                x500 = "CN=" + Environment.MachineName;
            }

            //X500DistinguishedNameFlags flag = X500DistinguishedNameFlags.UseUTF8Encoding;
            return(CreateSelfSignCertificatePfx(new X500DistinguishedName(x500), startTime, endTime, password));
        }
 public X509Certificate(byte[] rawData, System.Security.SecureString password)
 {
 }
 public X509Certificate(string fileName, System.Security.SecureString password)
 {
 }
Example #32
0
        /// <summary>Performs execution of the command, working asynchronously if required.</summary>
        /// <returns>
        /// A <see cref="System.Threading.Tasks.Task" /> that will be complete when handling of the method is completed.
        /// </returns>
        protected async System.Threading.Tasks.Task ProcessRecordAsync()
        {
            using ( NoSynchronizationContext )
            {
                await((Microsoft.Rest.ClientRuntime.IEventListener) this).Signal(Microsoft.Rest.ClientRuntime.Events.CmdletGetPipeline); if (((Microsoft.Rest.ClientRuntime.IEventListener) this).Token.IsCancellationRequested)
                {
                    return;
                }
                if (this.SkipSSL.ToBool())
                {
                    Pipeline = Nutanix.Powershell.Module.Instance.CreatePipelineWithProxy(this.MyInvocation.BoundParameters);
                }
                else
                {
                    Pipeline = Nutanix.Powershell.Module.Instance.CreatePipeline(this.MyInvocation.BoundParameters);
                }
                Pipeline.Prepend(HttpPipelinePrepend);
                Pipeline.Append(HttpPipelineAppend);

                if (Credential == null)
                {
                    if (Port == null)
                    {
                        Port = System.Environment.GetEnvironmentVariable("NutanixPort") ?? "9440";
                    }

                    if (Protocol == null)
                    {
                        Protocol = System.Environment.GetEnvironmentVariable("NutanixProtocol") ?? "https";
                    }

                    if (Server == null)
                    {
                        Server = System.Environment.GetEnvironmentVariable("NutanixServer") ?? "localhost";
                    }

                    if (Username == null)
                    {
                        Username = System.Environment.GetEnvironmentVariable("NutanixUsername") ?? "";
                    }

                    if (Password == null)
                    {
                        var psw = System.Environment.GetEnvironmentVariable("NutanixPassword") ?? "";
                        System.Security.SecureString result = new System.Security.SecureString();
                        foreach (char c in psw)
                        {
                            result.AppendChar(c);
                        }

                        Password = result;
                    }
                    //build url
                    var url = $"{Protocol}://{Server}:{Port}";
                    Credential = new Nutanix.Powershell.Models.NutanixCredential(url, Username, Password);
                }

                // get the client instance
                await((Microsoft.Rest.ClientRuntime.IEventListener) this).Signal(Microsoft.Rest.ClientRuntime.Events.CmdletBeforeAPICall); if (((Microsoft.Rest.ClientRuntime.IEventListener) this).Token.IsCancellationRequested)
                {
                    return;
                }
                await this.Client.ListSubnets(GetEntitiesRequest, onOK, onDefault, this, Pipeline, Credential);

                await((Microsoft.Rest.ClientRuntime.IEventListener) this).Signal(Microsoft.Rest.ClientRuntime.Events.CmdletAfterAPICall); if (((Microsoft.Rest.ClientRuntime.IEventListener) this).Token.IsCancellationRequested)
                {
                    return;
                }
            }
        }
Example #33
0
 public System.Security.Cryptography.RSACryptoServiceProvider LoadPrivateKeyFromString(System.Security.SecureString secPassPhrase, string keyFile)
 {
     byte[] privateKey = Convert.FromBase64String(keyFile);
     return(Utils.SSLKey.DecodeEncryptedPrivateKeyInfo(privateKey, secPassPhrase));
 }
Example #34
0
        private void buttonRename_Click(object sender, EventArgs e)
        {
            m_form.Focus();
            m_form.OutputBox.AppendText("\r\nRenaming computer, please wait...");
            this.Hide();
            if ((checkIfOnDomain(computername) == true) && (checkDomainCreds(textBoxDomainUserName.Text, textBoxDomainPassword.Text) == true) && (checkLocalCreds(textBoxLocalUserName.Text, textBoxLocalPassword.Text) == true))
            {
                try
                {
                    System.Security.SecureString sec   = convertToSecureString(textBoxLocalPassword.Text);
                    NetworkCredential            local = new NetworkCredential(computername + "\\" + textBoxLocalUserName.Text, sec);

                    ConnectionOptions conn = new ConnectionOptions
                    {
                        Authentication = AuthenticationLevel.PacketPrivacy,
                        //the rest of wmi objects will use the local admin so when joining to domain
                        //you must use your domain account
                        Impersonation    = ImpersonationLevel.Impersonate,
                        EnablePrivileges = true,
                        //needs to be local admin account that connects to machine
                        //local admin account
                        Username = local.UserName,
                        //local admin account password
                        SecurePassword = sec,
                    };
                    ManagementScope scope = new ManagementScope("\\\\" + computername + "\\root\\cimv2", conn);
                    scope.Connect();
                    WqlObjectQuery wqlQuery =
                        new WqlObjectQuery("SELECT * FROM Win32_ComputerSystem");
                    ManagementObjectSearcher searcher =
                        new ManagementObjectSearcher(scope, wqlQuery);

                    object[] methodArgs = { textBoxNewName.Text, textBoxDomainPassword.Text, textBoxDomainUserName.Text };

                    foreach (ManagementObject n in searcher.Get())
                    {
                        n.InvokeMethod("Rename", methodArgs);
                        methodArgs = null;
                    }


                    DialogResult result = System.Windows.Forms.MessageBox.Show("Do you want to restart this computer?", "Restart remote computer", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                               MessageBoxDefaultButton.Button1,
                                                                               MessageBoxOptions.DefaultDesktopOnly);
                    if (result == DialogResult.Yes)
                    {
                        Process          process = new Process();
                        ProcessStartInfo psi     = new ProcessStartInfo();
                        psi.FileName        = @"C:\Windows\System32\shutdown.exe";
                        psi.UseShellExecute = false;
                        psi.CreateNoWindow  = true;
                        string path = "\\\\" + computername;
                        string hh   = string.Format("\"{0}\"", path);
                        psi.Arguments     = @"/m " + path + " /r /t 0";
                        process.StartInfo = psi;
                        process.Start();
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("The computer will not show it is renamed until it is restarted", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Question,
                                                             MessageBoxDefaultButton.Button1,
                                                             MessageBoxOptions.DefaultDesktopOnly);
                        this.Close();
                    }

                    DialogResult moveOu = System.Windows.Forms.MessageBox.Show("Do you want to move this computer to another OU?", "Move remote computer", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                               MessageBoxDefaultButton.Button1,
                                                                               MessageBoxOptions.DefaultDesktopOnly);
                    if (moveOu == DialogResult.Yes)
                    {
                        using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain))
                        {
                            ComputerPrincipal computer = ComputerPrincipal.FindByIdentity(ctx, computername);

                            DirectoryEntry de = (DirectoryEntry)computer.GetUnderlyingObject();
                            de.MoveTo(new DirectoryEntry("LDAP://" + comboBoxOUs.Text));
                            de.CommitChanges();
                        }
                    }
                }
                catch (SystemException err)
                {
                    System.Windows.Forms.MessageBox.Show(err.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                         MessageBoxDefaultButton.Button1,
                                                         MessageBoxOptions.DefaultDesktopOnly);
                    this.Close();
                }
            }
            if ((checkIfOnDomain(computername) == false) && (checkLocalCreds(textBoxLocalUserName.Text, textBoxLocalPassword.Text) == true))
            {
                System.Security.SecureString sec   = convertToSecureString(textBoxLocalPassword.Text);
                NetworkCredential            local = new NetworkCredential(computername + "\\" + textBoxLocalUserName.Text, sec);
                try
                {
                    ConnectionOptions conn = new ConnectionOptions
                    {
                        Authentication = AuthenticationLevel.PacketPrivacy,
                        //the rest of wmi objects will use the local admin so when joining to domain
                        //you must use your domain account
                        Impersonation    = ImpersonationLevel.Impersonate,
                        EnablePrivileges = true,
                        //needs to be local admin account that connects to machine
                        //local admin account
                        Username = local.UserName,
                        //local admin account password
                        SecurePassword = sec,
                    };
                    ManagementScope scope = new ManagementScope("\\\\" + computername + "\\root\\cimv2", conn);
                    scope.Connect();
                    WqlObjectQuery wqlQuery =
                        new WqlObjectQuery("SELECT * FROM Win32_ComputerSystem");
                    ManagementObjectSearcher searcher =
                        new ManagementObjectSearcher(scope, wqlQuery);


                    object[] methodArgs = { textBoxNewName.Text };

                    foreach (ManagementObject n in searcher.Get())
                    {
                        n.InvokeMethod("Rename", methodArgs);
                        methodArgs = null;
                    }
                    DialogResult result = System.Windows.Forms.MessageBox.Show("Do you want to restart this computer?", "Restart remote computer", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                               MessageBoxDefaultButton.Button1,
                                                                               MessageBoxOptions.DefaultDesktopOnly);
                    if (result == DialogResult.Yes)
                    {
                        WqlObjectQuery wqlQuery0 =
                            new WqlObjectQuery("SELECT * FROM Win32_OperatingSystem");
                        ManagementObjectSearcher searcher0 =
                            new ManagementObjectSearcher(scope, wqlQuery0);
                        object[] methodArgs0 = { };

                        foreach (ManagementObject n in searcher0.Get())
                        {
                            n.InvokeMethod("Reboot", methodArgs0);
                            methodArgs0 = null;
                        }
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("The computer will not be show it is renamed until it is restarted", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Question,
                                                             MessageBoxDefaultButton.Button1,
                                                             MessageBoxOptions.DefaultDesktopOnly);
                        this.Close();
                    }
                }
                catch (SystemException err)
                {
                    System.Windows.Forms.MessageBox.Show(err.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                         MessageBoxDefaultButton.Button1,
                                                         MessageBoxOptions.DefaultDesktopOnly);
                    this.Close();
                }
            }
        }
        /// <summary>
        /// Loads the private key from a PFX file in the certificate store.
        /// </summary>
        public X509Certificate2 LoadPrivateKey(string thumbprint, string subjectName, System.Security.SecureString password)
        {
            if (m_certificateSubdir == null || !m_certificateSubdir.Exists)
            {
                return(null);
            }

            foreach (FileInfo file in m_certificateSubdir.GetFiles("*.der"))
            {
                try
                {
                    X509Certificate2 certificate = new X509Certificate2(file.FullName);

                    if (!String.IsNullOrEmpty(thumbprint))
                    {
                        if (certificate.Thumbprint != thumbprint)
                        {
                            continue;
                        }
                    }

                    if (!String.IsNullOrEmpty(subjectName))
                    {
                        if (!Utils.CompareDistinguishedName(subjectName, certificate.Subject))
                        {
                            if (subjectName.Contains("=") || !certificate.Subject.Contains("CN=" + subjectName))
                            {
                                continue;
                            }
                        }
                    }

                    string fileRoot = file.Name.Substring(0, file.Name.Length - file.Extension.Length);

                    StringBuilder filePath = new StringBuilder();
                    filePath.Append(m_privateKeySubdir.FullName);
                    filePath.Append("\\");
                    filePath.Append(fileRoot);

                    FileInfo privateKeyFile = new FileInfo(filePath.ToString() + ".pfx");

                    certificate = new X509Certificate2(
                        privateKeyFile.FullName,
                        (password == null)?new System.Security.SecureString():password,
                        X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);

                    System.Security.Cryptography.RSACryptoServiceProvider rsa = certificate.PrivateKey as System.Security.Cryptography.RSACryptoServiceProvider;

                    if (rsa != null && rsa.CspKeyContainerInfo.Exportable)
                    {
                        int    inputBlockSize = rsa.KeySize / 8 - 42;
                        byte[] bytes1         = rsa.Encrypt(new byte[inputBlockSize], true);
                        byte[] bytes2         = rsa.Decrypt(bytes1, true);

                        if (bytes2 != null)
                        {
                            // Utils.Trace(1, "RSA: {0}", certificate.Thumbprint);
                            return(certificate);
                        }
                    }

                    return(certificate);
                }
                catch (Exception e)
                {
                    Utils.Trace(e, "Could not load private key certificate from file: {0}", file.Name);
                }
            }

            return(null);
        }
Example #36
0
        public static byte[] CreateSelfSignCertificatePfx(
            string x500,
            DateTime startTime,
            DateTime endTime,
            SecureString password)
        {
            byte[] pfxData;

            if (x500 == null)
            {
                x500 = "";
            }

            SystemTime startSystemTime = ToSystemTime(startTime);
            SystemTime endSystemTime = ToSystemTime(endTime);
            string containerName = Guid.NewGuid().ToString();

            var dataHandle = new GCHandle();
            var providerContext = IntPtr.Zero;
            var cryptKey = IntPtr.Zero;
            var certContext = IntPtr.Zero;
            var certStore = IntPtr.Zero;
            var storeCertContext = IntPtr.Zero;
            var passwordPtr = IntPtr.Zero;
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Check(NativeMethods.CryptAcquireContextW(
                    out providerContext,
                    containerName,
                    null,
                    1, // PROV_RSA_FULL
                    8)); // CRYPT_NEWKEYSET

                Check(NativeMethods.CryptGenKey(
                    providerContext,
                    1, // AT_KEYEXCHANGE
                    1, // CRYPT_EXPORTABLE
                    out cryptKey));

                IntPtr errorStringPtr;
                int nameDataLength = 0;
                byte[] nameData;

                // errorStringPtr gets a pointer into the middle of the x500 string,
                // so x500 needs to be pinned until after we've copied the value
                // of errorStringPtr.
                dataHandle = GCHandle.Alloc(x500, GCHandleType.Pinned);

                if (!NativeMethods.CertStrToNameW(
                    0x00010001, // X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
                    dataHandle.AddrOfPinnedObject(),
                    3, // CERT_X500_NAME_STR = 3
                    IntPtr.Zero,
                    null,
                    ref nameDataLength,
                    out errorStringPtr))
                {
                    string error = Marshal.PtrToStringUni(errorStringPtr);
                    throw new ArgumentException(error);
                }

                nameData = new byte[nameDataLength];

                if (!NativeMethods.CertStrToNameW(
                    0x00010001, // X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
                    dataHandle.AddrOfPinnedObject(),
                    3, // CERT_X500_NAME_STR = 3
                    IntPtr.Zero,
                    nameData,
                    ref nameDataLength,
                    out errorStringPtr))
                {
                    string error = Marshal.PtrToStringUni(errorStringPtr);
                    throw new ArgumentException(error);
                }

                dataHandle.Free();

                dataHandle = GCHandle.Alloc(nameData, GCHandleType.Pinned);
                var nameBlob = new CryptoApiBlob(
                    nameData.Length,
                    dataHandle.AddrOfPinnedObject());

                var kpi = new CryptKeyProviderInformation();
                kpi.ContainerName = containerName;
                kpi.ProviderType = 1; // PROV_RSA_FULL
                kpi.KeySpec = 1; // AT_KEYEXCHANGE

                certContext = NativeMethods.CertCreateSelfSignCertificate(
                    providerContext,
                    ref nameBlob,
                    0,
                    ref kpi,
                    IntPtr.Zero, // default = SHA1RSA
                    ref startSystemTime,
                    ref endSystemTime,
                    IntPtr.Zero);
                Check(certContext != IntPtr.Zero);
                dataHandle.Free();

                certStore = NativeMethods.CertOpenStore(
                    "Memory", // sz_CERT_STORE_PROV_MEMORY
                    0,
                    IntPtr.Zero,
                    0x2000, // CERT_STORE_CREATE_NEW_FLAG
                    IntPtr.Zero);
                Check(certStore != IntPtr.Zero);

                Check(NativeMethods.CertAddCertificateContextToStore(
                    certStore,
                    certContext,
                    1, // CERT_STORE_ADD_NEW
                    out storeCertContext));

                NativeMethods.CertSetCertificateContextProperty(
                    storeCertContext,
                    2, // CERT_KEY_PROV_INFO_PROP_ID
                    0,
                    ref kpi);

                if (password != null)
                {
                    passwordPtr = Marshal.SecureStringToCoTaskMemUnicode(password);
                }

                var pfxBlob = new CryptoApiBlob();
                Check(NativeMethods.PFXExportCertStoreEx(
                    certStore,
                    ref pfxBlob,
                    passwordPtr,
                    IntPtr.Zero,
                    7)); // EXPORT_PRIVATE_KEYS | REPORT_NO_PRIVATE_KEY | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY

                pfxData = new byte[pfxBlob.DataLength];
                dataHandle = GCHandle.Alloc(pfxData, GCHandleType.Pinned);
                pfxBlob.Data = dataHandle.AddrOfPinnedObject();
                Check(NativeMethods.PFXExportCertStoreEx(
                    certStore,
                    ref pfxBlob,
                    passwordPtr,
                    IntPtr.Zero,
                    7)); // EXPORT_PRIVATE_KEYS | REPORT_NO_PRIVATE_KEY | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY
                dataHandle.Free();
            }
            finally
            {
                if (passwordPtr != IntPtr.Zero)
                {
                    Marshal.ZeroFreeCoTaskMemUnicode(passwordPtr);
                }

                if (dataHandle.IsAllocated)
                {
                    dataHandle.Free();
                }

                if (certContext != IntPtr.Zero)
                {
                    NativeMethods.CertFreeCertificateContext(certContext);
                }

                if (storeCertContext != IntPtr.Zero)
                {
                    NativeMethods.CertFreeCertificateContext(storeCertContext);
                }

                if (certStore != IntPtr.Zero)
                {
                    NativeMethods.CertCloseStore(certStore, 0);
                }

                if (cryptKey != IntPtr.Zero)
                {
                    NativeMethods.CryptDestroyKey(cryptKey);
                }

                if (providerContext != IntPtr.Zero)
                {
                    NativeMethods.CryptReleaseContext(providerContext, 0);
                    NativeMethods.CryptAcquireContextW(
                        out providerContext,
                        containerName,
                        null,
                        1, // PROV_RSA_FULL
                        0x10); // CRYPT_DELETEKEYSET
                }
            }

            return pfxData;
        }
Example #37
0
        /// <summary>
        /// Decrypts the specified data using a 192-bit cipher. The key can be any length.
        /// </summary>
        /// <param name="Data">The data to be decrypted. Will be converted to UTF8.</param>
        /// <param name="Key">The key used to decrypt the data.</param>
        /// <returns>A string containing the decoded data.</returns>
        public static System.Security.SecureString Decrypt192StringSecure(byte[] Data, byte[] Key)
        {
            AesCryptoServiceProvider AES = null;
            var MS = new MemoryStream(Data);
            CryptoStream CS = null;
            StreamReader DS = null;
            try
            {
                //Get the IV and length corrected Key.
                KeyData KeyData = GenerateKeyIV128(Key);
                //Create the AES crytpograhy object.
                AES = new AesCryptoServiceProvider { BlockSize = 192, KeySize = 192, Key = KeyData.Key, IV = KeyData.IV, Mode = CipherMode.CBC, Padding = PaddingMode.PKCS7 };
                CS = new CryptoStream(MS, AES.CreateDecryptor(), CryptoStreamMode.Read);
                DS = new StreamReader(CS, System.Text.Encoding.UTF8);

                var ss = new System.Security.SecureString();
                while (DS.EndOfStream == false)
                    ss.AppendChar(Convert.ToChar(DS.Read()));
                ss.MakeReadOnly();
                return ss;
            }
            finally
            {
                if (AES != null) AES.Clear();
                MS.Dispose();
                if (CS != null) CS.Dispose();
                if (DS != null) DS.Dispose();
            }
        }
Example #38
0
        private void buttonUnjoin_Click(object sender, EventArgs e)
        {
            m_form.Focus();
            m_form.OutputBox.AppendText("\r\nUnjoining computer from domain, please wait...");
            this.Hide();
            if ((checkIfOnDomain(computername) == true) && (checkDomainCreds(textBoxDomainUserName.Text, textBoxDomainPassword.Text) == true) && (checkLocalCreds(textBoxLocalUserName.Text, textBoxLocalPassword.Text) == true))
            {
                try
                {
                    System.Security.SecureString sec   = convertToSecureString(textBoxLocalPassword.Text);
                    NetworkCredential            local = new NetworkCredential(computername + "\\" + textBoxLocalUserName.Text, sec);

                    ConnectionOptions conn = new ConnectionOptions
                    {
                        Authentication = AuthenticationLevel.PacketPrivacy,
                        //the rest of wmi objects will use the local admin so when joining to domain
                        //you must use your domain account
                        Impersonation    = ImpersonationLevel.Impersonate,
                        EnablePrivileges = true,
                        //needs to be local admin account that connects to machine
                        //local admin account
                        Username = local.UserName,
                        //local admin account password
                        SecurePassword = local.SecurePassword,
                    };
                    ManagementScope scope = new ManagementScope("\\\\" + computername + "\\root\\cimv2", conn);
                    scope.Connect();
                    WqlObjectQuery wqlQuery =
                        new WqlObjectQuery("SELECT * FROM Win32_ComputerSystem");
                    ManagementObjectSearcher searcher =
                        new ManagementObjectSearcher(scope, wqlQuery);
                    object[] methodArgs = { textBoxDomainPassword.Text, textBoxDomainUserName.Text, 0 };

                    foreach (ManagementObject n in searcher.Get())
                    {
                        n.InvokeMethod("UnjoinDomainOrWorkgroup", methodArgs);
                    }
                    //creats psexec to restart remote computer
                    DialogResult result = System.Windows.Forms.MessageBox.Show("Do you want to restart this computer?", "Restart remote computer", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                               MessageBoxDefaultButton.Button1,
                                                                               MessageBoxOptions.DefaultDesktopOnly);
                    if (result == DialogResult.Yes)
                    {
                        WqlObjectQuery wqlQuery0 =
                            new WqlObjectQuery("SELECT * FROM Win32_OperatingSystem");
                        ManagementObjectSearcher searcher0 =
                            new ManagementObjectSearcher(scope, wqlQuery0);
                        object[] methodArgs0 = { };

                        foreach (ManagementObject n in searcher0.Get())
                        {
                            n.InvokeMethod("Reboot", methodArgs0);
                            methodArgs0 = null;
                        }
                        System.Windows.Forms.MessageBox.Show("Computer is now being restarted. Please check computer to ensure it has been properly removed from the domain", "Unjoin successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("The computer will not be completely unjoined until it is restarted", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Question,
                                                             MessageBoxDefaultButton.Button1,
                                                             MessageBoxOptions.DefaultDesktopOnly);
                        this.Close();
                    }
                }
                catch (SystemException err)
                {
                    System.Windows.Forms.MessageBox.Show(err.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                         MessageBoxDefaultButton.Button1,
                                                         MessageBoxOptions.DefaultDesktopOnly);
                    this.Close();
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Computer is not on the domain or your account credentials are wrong.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                     MessageBoxDefaultButton.Button1,
                                                     MessageBoxOptions.DefaultDesktopOnly);
                this.Close();
            }
        }
        internal static byte[] CreateSelfSignCertificatePfx(
            string x500,
            DateTime startTime,
            DateTime endTime,
            SecureString password)
        {
            byte[] pfxData;

            if (x500 == null)
            {
                x500 = "";
            }

            SystemTime startSystemTime = ToSystemTime(startTime);
            SystemTime endSystemTime   = ToSystemTime(endTime);
            string     containerName   = Guid.NewGuid().ToString();

            GCHandle dataHandle       = new GCHandle();
            IntPtr   providerContext  = IntPtr.Zero;
            IntPtr   cryptKey         = IntPtr.Zero;
            IntPtr   certContext      = IntPtr.Zero;
            IntPtr   certStore        = IntPtr.Zero;
            IntPtr   storeCertContext = IntPtr.Zero;
            IntPtr   passwordPtr      = IntPtr.Zero;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Check(NativeMethods.CryptAcquireContextW(
                          out providerContext,
                          containerName,
                          null,
                          1,   // PROV_RSA_FULL
                          8)); // CRYPT_NEWKEYSET

                Check(NativeMethods.CryptGenKey(
                          providerContext,
                          1,                // AT_KEYEXCHANGE
                          1 | (2048 << 16), // CRYPT_EXPORTABLE | 2048bit
                          out cryptKey));

                IntPtr errorStringPtr;
                int    nameDataLength = 0;
                byte[] nameData;

                // errorStringPtr gets a pointer into the middle of the x500 string,
                // so x500 needs to be pinned until after we've copied the value
                // of errorStringPtr.
                dataHandle = GCHandle.Alloc(x500, GCHandleType.Pinned);

                if (!NativeMethods.CertStrToNameW(
                        0x00010001, // X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
                        dataHandle.AddrOfPinnedObject(),
                        3,          // CERT_X500_NAME_STR = 3
                        IntPtr.Zero,
                        null,
                        ref nameDataLength,
                        out errorStringPtr))
                {
                    string error = Marshal.PtrToStringUni(errorStringPtr);
                    throw new ArgumentException(error);
                }

                nameData = new byte[nameDataLength];

                if (!NativeMethods.CertStrToNameW(
                        0x00010001, // X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
                        dataHandle.AddrOfPinnedObject(),
                        3,          // CERT_X500_NAME_STR = 3
                        IntPtr.Zero,
                        nameData,
                        ref nameDataLength,
                        out errorStringPtr))
                {
                    string error = Marshal.PtrToStringUni(errorStringPtr);
                    throw new ArgumentException(error);
                }

                dataHandle.Free();

                dataHandle = GCHandle.Alloc(nameData, GCHandleType.Pinned);
                CryptoApiBlob nameBlob = new CryptoApiBlob(
                    nameData.Length,
                    dataHandle.AddrOfPinnedObject());

                CryptKeyProviderInformation kpi = new CryptKeyProviderInformation();
                kpi.ContainerName = containerName;
                kpi.ProviderType  = 1; // PROV_RSA_FULL
                kpi.KeySpec       = 1; // AT_KEYEXCHANGE

                certContext = NativeMethods.CertCreateSelfSignCertificate(
                    providerContext,
                    ref nameBlob,
                    0,
                    ref kpi,
                    IntPtr.Zero, // default = SHA1RSA
                    ref startSystemTime,
                    ref endSystemTime,
                    IntPtr.Zero);
                Check(certContext != IntPtr.Zero);
                dataHandle.Free();

                certStore = NativeMethods.CertOpenStore(
                    "Memory", // sz_CERT_STORE_PROV_MEMORY
                    0,
                    IntPtr.Zero,
                    0x2000, // CERT_STORE_CREATE_NEW_FLAG
                    IntPtr.Zero);
                Check(certStore != IntPtr.Zero);

                Check(NativeMethods.CertAddCertificateContextToStore(
                          certStore,
                          certContext,
                          1, // CERT_STORE_ADD_NEW
                          out storeCertContext));

                NativeMethods.CertSetCertificateContextProperty(
                    storeCertContext,
                    2, // CERT_KEY_PROV_INFO_PROP_ID
                    0,
                    ref kpi);

                if (password != null)
                {
                    passwordPtr = Marshal.SecureStringToCoTaskMemUnicode(password);
                }

                CryptoApiBlob pfxBlob = new CryptoApiBlob();
                Check(NativeMethods.PFXExportCertStoreEx(
                          certStore,
                          ref pfxBlob,
                          passwordPtr,
                          IntPtr.Zero,
                          7)); // EXPORT_PRIVATE_KEYS | REPORT_NO_PRIVATE_KEY | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY

                pfxData      = new byte[pfxBlob.DataLength];
                dataHandle   = GCHandle.Alloc(pfxData, GCHandleType.Pinned);
                pfxBlob.Data = dataHandle.AddrOfPinnedObject();
                Check(NativeMethods.PFXExportCertStoreEx(
                          certStore,
                          ref pfxBlob,
                          passwordPtr,
                          IntPtr.Zero,
                          7)); // EXPORT_PRIVATE_KEYS | REPORT_NO_PRIVATE_KEY | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY
                dataHandle.Free();
            }
            finally
            {
                if (passwordPtr != IntPtr.Zero)
                {
                    Marshal.ZeroFreeCoTaskMemUnicode(passwordPtr);
                }

                if (dataHandle.IsAllocated)
                {
                    dataHandle.Free();
                }

                if (certContext != IntPtr.Zero)
                {
                    NativeMethods.CertFreeCertificateContext(certContext);
                }

                if (storeCertContext != IntPtr.Zero)
                {
                    NativeMethods.CertFreeCertificateContext(storeCertContext);
                }

                if (certStore != IntPtr.Zero)
                {
                    NativeMethods.CertCloseStore(certStore, 0);
                }

                if (cryptKey != IntPtr.Zero)
                {
                    NativeMethods.CryptDestroyKey(cryptKey);
                }

                if (providerContext != IntPtr.Zero)
                {
                    NativeMethods.CryptReleaseContext(providerContext, 0);
                    NativeMethods.CryptAcquireContextW(
                        out providerContext,
                        containerName,
                        null,
                        1,     // PROV_RSA_FULL
                        0x10); // CRYPT_DELETEKEYSET
                }
            }

            return(pfxData);
        }
Example #40
0
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     this.DialogResult = true;
     UserName          = tbUserName.Text;
     Password          = pwdPassword.SecurePassword;
 }
 public static System.Diagnostics.Process Start(string fileName, string arguments, string userName, System.Security.SecureString password, string domain)
 {
     throw null;
 }
Example #42
0
        /// <summary>
        /// Finds the process with the ID and attempts to kill the specified mutex type
        /// Specify a null username to run as an administrator
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="username"></param>
        /// <param name="password">The password for the username or null to run as the current user</param>
        public static void KillMutexWindow(Settings.AccountType type, int pid, string username, System.Security.SecureString password)
        {
            string n;

            if (type == Settings.AccountType.GuildWars1)
            {
                n = "Guild Wars";
            }
            else
            {
                n = "Guild Wars 2";
            }
            var path = GetPath();
            var p    = new ProcessStartInfo(path, "-pu -handle -pid " + pid + " \"" + GetMutexName(type) + "\" " + (byte)Windows.Win32Handles.MatchMode.EndsWith);

            if (username != null)
            {
                p.UseShellExecute = false;
                if (password != null)
                {
                    try
                    {
                        //other users will be using this
                        Util.FileUtil.AllowFileAccess(path, System.Security.AccessControl.FileSystemRights.Modify);
                    }
                    catch (Exception ex)
                    {
                        Util.Logging.Log(ex);
                    }

                    p.UserName         = username;
                    p.LoadUserProfile  = true;
                    p.Password         = password;
                    p.WorkingDirectory = Path.GetPathRoot(path); //the user may not have access to default working directory
                }
            }
            else
            {
                p.UseShellExecute = true;
                p.Verb            = "runas";
            }

            using (var proc = Process.Start(p))
            {
                proc.WaitForExit();
            }
        }
 public EventLogSession(string server, string domain, string user, System.Security.SecureString password, System.Diagnostics.Eventing.Reader.SessionAuthentication logOnType)
 {
 }
Example #44
0
        private void buttonJoin_Click(object sender, EventArgs e)
        {
            m_form.Focus();
            m_form.OutputBox.AppendText("\r\nJoining computer to domain, please wait...");
            this.Hide();
            if (((checkIfOnDomain(computername)) == false) && (checkDomainCreds(textBoxDomainUserName.Text, textBoxDomainPassword.Text) == true) && (checkLocalCreds(textBoxLocalUserName.Text, textBoxLocalPassword.Text) == true) && (!String.IsNullOrEmpty(domainNametextBox.Text)))
            {
                try
                {
                    /*
                     * System.Security.SecureString localsec = convertToSecureString(textBoxLocalPassword.Text);
                     * NetworkCredential local = new NetworkCredential(computername + @"\" + textBoxLocalUserName.Text, textBoxLocalPassword.Text);
                     * NetworkCredential domain = new NetworkCredential(textBoxDomainUserName.Text, textBoxDomainPassword.Text);
                     *
                     * MessageBox.Show("Join " + val);
                     */
                    //comboBoxOUs.Enabled = false;
                    textBoxNewName.Enabled = true;


                    System.Security.SecureString sec   = convertToSecureString(textBoxLocalPassword.Text);
                    NetworkCredential            local = new NetworkCredential(computername + "\\" + textBoxLocalUserName.Text, sec);

                    ConnectionOptions conn = new ConnectionOptions
                    {
                        Authentication = AuthenticationLevel.PacketPrivacy,
                        //the rest of wmi objects will use the local admin so when joining to domain
                        //you must use your domain account
                        Impersonation    = ImpersonationLevel.Impersonate,
                        EnablePrivileges = true,
                        //needs to be local admin account that connects to machine
                        //local admin account
                        Username = local.UserName,
                        //local admin account password
                        SecurePassword = local.SecurePassword,
                    };
                    ManagementScope scope = new ManagementScope("\\\\" + computername + "\\root\\cimv2", conn);
                    scope.Connect();
                    WqlObjectQuery wqlQuery =
                        new WqlObjectQuery("SELECT * FROM Win32_ComputerSystem");
                    ManagementObjectSearcher searcher =
                        new ManagementObjectSearcher(scope, wqlQuery);

                    object[] methodArgs  = { domainNametextBox.Text, textBoxDomainPassword.Text, textBoxDomainUserName.Text, comboBoxOUs.Text, 3 };
                    object[] methodArgs2 = { textBoxNewName.Text };
                    if (!(String.IsNullOrEmpty(textBoxNewName.Text)))
                    {
                        m_form.OutputBox.AppendText("\r\nRenaming....");
                        foreach (ManagementObject n in searcher.Get())
                        {
                            returnval0 = n.InvokeMethod("Rename", methodArgs2);
                        }
                        MessageBox.Show("Rename " + returnval0);
                    }

                    m_form.OutputBox.AppendText("\r\nJoining....");
                    foreach (ManagementObject n in searcher.Get())
                    {
                        returnval1 = n.InvokeMethod("JoinDomainOrWorkgroup", methodArgs);
                    }
                    if (Convert.ToInt32(returnval1) == 2224)
                    {
                    }

                    MessageBox.Show("Join " + returnval1);
                    methodArgs  = null;
                    methodArgs2 = null;

                    DialogResult result = System.Windows.Forms.MessageBox.Show("Do you want to restart this computer?", "Restart remote computer", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                               MessageBoxDefaultButton.Button1,
                                                                               MessageBoxOptions.DefaultDesktopOnly);
                    if (result == DialogResult.Yes)
                    {
                        WqlObjectQuery wqlQuery0 =
                            new WqlObjectQuery("SELECT * FROM Win32_OperatingSystem");
                        ManagementObjectSearcher searcher0 =
                            new ManagementObjectSearcher(scope, wqlQuery0);
                        object[] methodArgs0 = { };

                        foreach (ManagementObject n in searcher0.Get())
                        {
                            n.InvokeMethod("Reboot", methodArgs0);
                            methodArgs0 = null;
                        }
                        System.Windows.Forms.MessageBox.Show("Computer is now being restarted. Please check computer to ensure it has been properly added to the domain", "Join successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("The computer will not be completely joined until it is restarted", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Question,
                                                             MessageBoxDefaultButton.Button1,
                                                             MessageBoxOptions.DefaultDesktopOnly);
                    }

                    this.Close();
                }
                catch (SystemException err)
                {
                    System.Windows.Forms.MessageBox.Show(err.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                         MessageBoxDefaultButton.Button1,
                                                         MessageBoxOptions.DefaultDesktopOnly);
                    this.Close();
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Computer is already on the domain.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                     MessageBoxDefaultButton.Button1,
                                                     MessageBoxOptions.DefaultDesktopOnly);
                this.Close();
            }
        }
 public X509Certificate(byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags)
 {
 }
 public void ChangePassword(CSEntry csentry, System.Security.SecureString oldPassword, System.Security.SecureString newPassword)
 {
     throw new EntryPointNotImplementedException();
 }
 public X509Certificate(string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags)
 {
 }
Example #48
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SCCMAgent"/> class.
        /// </summary>
        /// <param name="hostname">The hostname.</param>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <param name="wsManPort">The ws man port.</param>
        /// <param name="Connect">if set to <c>true</c> [connect].</param>
        /// <param name="encryption">if set to <c>true</c> [encryption].</param>
        public SCCMAgent(string hostname, string username, System.Security.SecureString password, int wsManPort, bool Connect, bool encryption)
        {
            PSCredential credential = new PSCredential(username, password);

            Initialize(hostname, credential, wsManPort, Connect, encryption);
        }
Example #49
0
        /// <summary>建立自签名证书</summary>
        /// <param name="distName"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static Byte[] CreateSelfSignCertificatePfx(X500DistinguishedName distName, DateTime startTime, DateTime endTime, SecureString password)
        {
            var containerName = Guid.NewGuid().ToString();

            var dataHandle       = new GCHandle();
            var providerContext  = IntPtr.Zero;
            var cryptKey         = IntPtr.Zero;
            var certContext      = IntPtr.Zero;
            var certStore        = IntPtr.Zero;
            var storeCertContext = IntPtr.Zero;
            var passwordPtr      = IntPtr.Zero;

//#if !NETCOREAPP
//            RuntimeHelpers.PrepareConstrainedRegions();
//#endif

            try
            {
                Check(NativeMethods.CryptAcquireContextW(
                          out providerContext,
                          containerName,
                          null,
                          1,   // PROV_RSA_FULL
                          8)); // CRYPT_NEWKEYSET

                Check(NativeMethods.CryptGenKey(
                          providerContext,
                          1, // AT_KEYEXCHANGE
                          1, // CRYPT_EXPORTABLE
                          out cryptKey));

                var nameData = distName.RawData;

                dataHandle = GCHandle.Alloc(nameData, GCHandleType.Pinned);
                var nameBlob = new CryptoApiBlob(nameData.Length, dataHandle.AddrOfPinnedObject());

                var kpi = new CryptKeyProviderInformation
                {
                    ContainerName = containerName,
                    ProviderType  = 1, // PROV_RSA_FULL
                    KeySpec       = 1  // AT_KEYEXCHANGE
                };

                var startSystemTime = ToSystemTime(startTime);
                var endSystemTime   = ToSystemTime(endTime);
                certContext = NativeMethods.CertCreateSelfSignCertificate(
                    providerContext,
                    ref nameBlob,
                    0,
                    ref kpi,
                    IntPtr.Zero, // default = SHA1RSA
                    ref startSystemTime,
                    ref endSystemTime,
                    IntPtr.Zero);
                Check(certContext != IntPtr.Zero);
                dataHandle.Free();

                certStore = NativeMethods.CertOpenStore(
                    "Memory", // sz_CERT_STORE_PROV_MEMORY
                    0,
                    IntPtr.Zero,
                    0x2000, // CERT_STORE_CREATE_NEW_FLAG
                    IntPtr.Zero);
                Check(certStore != IntPtr.Zero);

                Check(NativeMethods.CertAddCertificateContextToStore(
                          certStore,
                          certContext,
                          1, // CERT_STORE_ADD_NEW
                          out storeCertContext));

                NativeMethods.CertSetCertificateContextProperty(
                    storeCertContext,
                    2, // CERT_KEY_PROV_INFO_PROP_ID
                    0,
                    ref kpi);

                if (password != null)
                {
                    passwordPtr = Marshal.SecureStringToCoTaskMemUnicode(password);
                }

                var pfxBlob = new CryptoApiBlob();
                Check(NativeMethods.PFXExportCertStoreEx(
                          certStore,
                          ref pfxBlob,
                          passwordPtr,
                          IntPtr.Zero,
                          7)); // EXPORT_PRIVATE_KEYS | REPORT_NO_PRIVATE_KEY | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY

                var pfxData = new Byte[pfxBlob.DataLength];
                dataHandle   = GCHandle.Alloc(pfxData, GCHandleType.Pinned);
                pfxBlob.Data = dataHandle.AddrOfPinnedObject();
                Check(NativeMethods.PFXExportCertStoreEx(
                          certStore,
                          ref pfxBlob,
                          passwordPtr,
                          IntPtr.Zero,
                          7)); // EXPORT_PRIVATE_KEYS | REPORT_NO_PRIVATE_KEY | REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY
                dataHandle.Free();

                return(pfxData);
            }
            finally
            {
                if (passwordPtr != IntPtr.Zero)
                {
                    Marshal.ZeroFreeCoTaskMemUnicode(passwordPtr);
                }

                if (dataHandle.IsAllocated)
                {
                    dataHandle.Free();
                }

                if (certContext != IntPtr.Zero)
                {
                    NativeMethods.CertFreeCertificateContext(certContext);
                }

                if (storeCertContext != IntPtr.Zero)
                {
                    NativeMethods.CertFreeCertificateContext(storeCertContext);
                }

                if (certStore != IntPtr.Zero)
                {
                    NativeMethods.CertCloseStore(certStore, 0);
                }

                if (cryptKey != IntPtr.Zero)
                {
                    NativeMethods.CryptDestroyKey(cryptKey);
                }

                if (providerContext != IntPtr.Zero)
                {
                    NativeMethods.CryptReleaseContext(providerContext, 0);
                    NativeMethods.CryptAcquireContextW(
                        out providerContext,
                        containerName,
                        null,
                        1,     // PROV_RSA_FULL
                        0x10); // CRYPT_DELETEKEYSET
                }
            }
        }
Example #50
0
        /// <summary>
        /// Connect to a remote SCCM Agent by using WSMan
        /// </summary>
        /// <param name="hostname">target computername</param>
        /// <param name="username">username for the connection</param>
        /// <param name="password">password for the connection</param>
        /// <param name="wsManPort">WSManagement Port (Default = 5985)</param>
        public SCCMAgent(string hostname, string username, System.Security.SecureString password, int wsManPort)
        {
            PSCredential credential = new PSCredential(username, password);

            Initialize(hostname, credential, wsManPort, true, false);
        }
Example #51
0
        static void Main(string[] args)
        {
            string usrUser   = Properties.Settings.Default.User;
            string usrInPass = Properties.Settings.Default.Pass;
            string usrURL    = Properties.Settings.Default.URL;

            System.Security.SecureString usrPass = new System.Security.SecureString();
            foreach (char chr in usrInPass.ToCharArray())
            {
                usrPass.AppendChar(chr);
            }

            using (ClientContext ctx = new ClientContext(usrURL))
            {
                ctx.Credentials = new SharePointOnlineCredentials(usrUser, usrPass);
                Web web = ctx.Web;
                ctx.Load(web);
                ctx.ExecuteQuery();

                CrearLista creacion = new CrearLista("Categoria", "categoria", "Almacena los datos de las categorías en los que agrupan los platos.", (int)ListTemplateType.GenericList, ctx);
                creacion.Crear();
                creacion.CambiarDisplay();
                List listaCategoria = creacion.Ref;

                creacion = new CrearLista("Ingredientes", "ingredientes", "Almacena los datos de los ingredientes para las ensaladas.", (int)ListTemplateType.GenericList, ctx);
                creacion.Crear();
                creacion.CambiarDisplay();
                List listaIngredientes = creacion.Ref;

                creacion = new CrearLista("Guarnicion", "guarnicion", "Almacena los datos de las guarniciones que acompañan los platos.", (int)ListTemplateType.GenericList, ctx);
                creacion.Crear();
                creacion.CambiarDisplay();
                List listaGuarnicion = creacion.Ref;

                creacion = new CrearLista("Carta", "carta", "Almacena los datos de los platos establecido en el menú.", (int)ListTemplateType.GenericList, ctx);
                creacion.Crear();
                creacion.CambiarDisplay();
                List listaCarta = creacion.Ref;

                creacion = new CrearLista("Pedidos", "pedidos", "Almacena los datos de los pedidos.", (int)ListTemplateType.GenericList, ctx);
                creacion.Crear();
                creacion.CambiarDisplay();
                List listaPedido = creacion.Ref;

                creacion = new CrearLista("Pedido Detalle", "pedidodetalle", "Almacena el detalle de los pedidos.", (int)ListTemplateType.GenericList, ctx);
                creacion.Crear();
                creacion.CambiarDisplay();
                List listaPedidoDetalle = creacion.Ref;

                //Creacion de Fields
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("-- CREANDO CAMPOS --");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Responsabilidad de FEDE y CAROs.");
                Console.ForegroundColor = ConsoleColor.Yellow;
                int cntF = 0;


                //Categoría Guarnicion
                Console.WriteLine("  Definiendo Campos de: {0} ", "Categoría");
                listaCategoria.Fields.AddFieldAsXml("<Field ID='{F266F118-3B06-48EE-9DF4-3E3FD0CC94CA}' "
                                                    + " DisplayName='catGuarnicion' "
                                                    + " Name='catGuarnicion' "
                                                    + " Type ='LookupMulti' "
                                                    + " List='{" + listaGuarnicion.Id + "}' "
                                                    + " ShowField='Title' "
                                                    + " Mult='TRUE' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Guarnicion");
                try
                {
                    ctx.ExecuteQuery();
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("    - EXISTENTE");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Field Campo = listaCategoria.Fields.GetByInternalNameOrTitle("catGuarnicion");
                Campo.Title = "Guarnición";
                Campo.Update();
                cntF++;
                ctx.ExecuteQuery();

                //Ingredientes Disponibilidad --------------------------------------------------------------------------------------------
                Console.WriteLine("  Definiendo Campos de: {0} ", "Ingredientes");
                listaIngredientes.Fields.AddFieldAsXml("<Field ID='{5BF90F4C-E9DA-47AB-8863-19B7B27DBC95}' "
                                                       + " DisplayName='ingDisponibilidad' "
                                                       + " Name='ingDisponibilidad' "
                                                       + " Type='Boolean' "
                                                       + " Required='TRUE'>"
                                                       + " <Default>1</Default>"
                                                       + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Disponibilidad");
                listaIngredientes.Update();
                try
                {
                    ctx.ExecuteQuery();
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("    - EXISTENTE");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Campo       = listaIngredientes.Fields.GetByInternalNameOrTitle("ingDisponibilidad");
                Campo.Title = "Disponibilidad";
                Campo.Update();
                cntF++;
                ctx.ExecuteQuery();

                //Guarnicion Disponibilidad --------------------------------------------------------------------------------------------
                Console.WriteLine("  Definiendo Campos de: {0} ", "Guarnición");
                listaGuarnicion.Fields.AddFieldAsXml("<Field ID='{65C95CD6-DE9D-4104-81E6-906DA253ACC6}' "
                                                     + " DisplayName='guaDisponibilidad' "
                                                     + " Name='guaDisponibilidad' "
                                                     + " Type ='Boolean' "
                                                     + " Required='TRUE'>"
                                                     + " <Default>1</Default>"
                                                     + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Disponibilidad");
                listaGuarnicion.Update();
                try
                {
                    ctx.ExecuteQuery();
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("    -EXISTENTE");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Campo       = listaGuarnicion.Fields.GetByInternalNameOrTitle("guaDisponibilidad");
                Campo.Title = "Disponibilidad";
                Campo.Update();
                cntF++;
                ctx.ExecuteQuery();

                //Carta Categoria --------------------------------------------------------------------------------------------
                Console.WriteLine("  Definiendo Campos de: {0} ", "Carta");
                listaCarta.Fields.AddFieldAsXml("<Field ID='{553BCE71-1FB0-441A-9A25-CED4EAA24C47}' "
                                                + " DisplayName='carCategoria' "
                                                + " Name='carCategoria' "
                                                + " Type='Lookup' "
                                                + " List='{" + listaCategoria.Id + "}' "
                                                + " ShowField='Title' "
                                                + " Indexed='TRUE' "
                                                + " Required='TRUE' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Categoria");
                //Carta Disponibilidad
                listaCarta.Fields.AddFieldAsXml("<Field ID='{7696EE45-CBF1-4541-88B7-BB8B0EAC52DD}' "
                                                + " DisplayName='carDisponibilidad' "
                                                + " Name='carDisponibilidad' "
                                                + " Type ='Boolean' "
                                                + " Required='TRUE'>"
                                                + " <Default>1</Default>"
                                                + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Disponibilidad");
                //Carta Precio
                listaCarta.Fields.AddFieldAsXml("<Field ID='{891E690D-94EF-416F-BE34-B6D21D145BB4}' "
                                                + " DisplayName='carPrecio' "
                                                + " Name='carPrecio' "
                                                + " Type ='Currency' "
                                                + " LCID= '11274'"
                                                + " Min= '0' "
                                                + " Required='TRUE'/>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Precio");
                //Carta Descuento
                listaCarta.Fields.AddFieldAsXml("<Field ID='{ED828D92-0444-457B-A4E5-0652BBC7AB6B}' "
                                                + " DisplayName='carDescuento' "
                                                + " Name='carDescuento' "
                                                + " Type ='Number' "
                                                + " Min= '0' "
                                                + " Percentage='TRUE'"
                                                + " Required='TRUE'>"
                                                + " <Default>0</Default>"
                                                + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Descuento");
                //Carta Total
                listaCarta.Fields.AddFieldAsXml("<Field ID='{428F1064-C8AA-491F-AEE3-B3FD6146B9DA}'"
                                                + " DisplayName='carTotal' "
                                                + " Name='carTotal' "
                                                + " Type ='Calculated' "
                                                + " LCID= '11274'"
                                                + " Min= '0' "
                                                + " Required='TRUE' "
                                                + " ResultType='Currency' >"
                                                + "<Formula> =[carDescuento]*[carPrecio]</Formula>"
                                                + "<FieldRefs>"
                                                + "<FieldRef Name='carPrecio' />"
                                                + "<FieldRef Name='carDescuento' />"
                                                + "</FieldRefs>"
                                                + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Total");
                listaCarta.Update();
                try
                {
                    ctx.ExecuteQuery();
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("    -EXISTENTE");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Field[] CamposCarta = new Field[5];
                CamposCarta[0]       = listaCarta.Fields.GetByInternalNameOrTitle("carCategoria");
                CamposCarta[0].Title = "Categoría";
                CamposCarta[1]       = listaCarta.Fields.GetByInternalNameOrTitle("carDisponibilidad");
                CamposCarta[1].Title = "Disponibilidad";
                CamposCarta[2]       = listaCarta.Fields.GetByInternalNameOrTitle("carPrecio");
                CamposCarta[2].Title = "Precio";
                CamposCarta[3]       = listaCarta.Fields.GetByInternalNameOrTitle("carDescuento");
                CamposCarta[3].Title = "Descuento";
                CamposCarta[4]       = listaCarta.Fields.GetByInternalNameOrTitle("carTotal");
                CamposCarta[4].Title = "Total";
                foreach (Field c in CamposCarta)
                {
                    c.Update();
                    cntF++;
                }
                ctx.ExecuteQuery();
                //Pedidos Observaciones --------------------------------------------------------------------------------------------
                Console.WriteLine("  Definiendo Campos de: {0} ", "Pedidos");
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedObsevaciones' "
                                                 + " ID='{A80C1348-14CE-4441-8259-E5D4E18DC93A}' "
                                                 + " Name='pedObsevaciones' "
                                                 + " Type ='Note' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Observaciones");
                //Pedidos Estado
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedEstado' "
                                                 + " ID='{72B7F7D5-253A-4957-A6BE-14DFC6ABA116}' "
                                                 + " Name='pedEstado' "
                                                 + " Type ='Choice' >"
                                                 + " <CHOICES>"
                                                 + "<CHOICE>Pendiente</CHOICE>"
                                                 + "<CHOICE>Cancelado</CHOICE>"
                                                 + "<CHOICE>Listo</CHOICE>"
                                                 + "<CHOICE>Finalizado</CHOICE>"
                                                 + " </CHOICES>"
                                                 + " <Default>Pendiente</Default>"
                                                 + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Estado");
                //Pedidos Ubicación
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedUbicacion' "
                                                 + " ID='{81C5AFE3-5D85-4E85-8E76-62C3D612D610}' "
                                                 + " Name='pedUbicacion' "
                                                 + " Type ='Text' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Ubicación");
                //Pedidos SubTotal
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedSubTotal' "
                                                 + " ID='{F9883EA5-03FC-460A-8A61-7FAD0219BF08}' "
                                                 + " Name='pedSubTotal' "
                                                 + " Type ='Currency' "
                                                 + " LCID= '11274'"
                                                 + " Min= '0' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "SubTotal");
                //Pedidos Historial Estado
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedHistorialEstado' "
                                                 + " ID='{B4A1021F-6256-4F06-86EC-C0ED1EB38B04}' "
                                                 + " Name='pedHistorialEstado' "
                                                 + " Type ='Note' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Historial Estado");
                //Pedido Horario
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedHorario' "
                                                 + " ID='{A2782181-6653-49A3-B756-7A39608A5AFF}' "
                                                 + " Name='pedHorario' "
                                                 + " Type ='DateTime' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Horario");
                //Pedido Bonificaciones
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedBonificaciones' "
                                                 + " ID='{B652D0D1-D682-4AD5-9239-CFA7203DA4B5}' "
                                                 + " Name='pedBonificaciones' "
                                                 + " Type ='Currency' "
                                                 + " LCID= '11274'"
                                                 + " Min= '0' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Bonificaciones");
                //Pedido Total
                listaPedido.Fields.AddFieldAsXml("<Field DisplayName='pedTotal' "
                                                 + " ID='{2067DC44-00C2-433D-945D-E01C01DFD808}' "
                                                 + " Name='pedTotal' "
                                                 + " Type ='Currency' "
                                                 + " LCID= '11274'"
                                                 + " Min= '0' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Total");
                listaPedido.Update();
                try
                {
                    ctx.ExecuteQuery();
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("    -EXISTENTE");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Field[] CamposPedido = new Field[8];
                CamposPedido[0]       = listaPedido.Fields.GetByInternalNameOrTitle("pedObservaciones");
                CamposPedido[0].Title = "Observaciones";
                CamposPedido[1]       = listaPedido.Fields.GetByInternalNameOrTitle("pedEstado");
                CamposPedido[1].Title = "Estado";
                CamposPedido[2]       = listaPedido.Fields.GetByInternalNameOrTitle("pedUbicacion");
                CamposPedido[2].Title = "Ubicación";
                CamposPedido[3]       = listaPedido.Fields.GetByInternalNameOrTitle("pedSubTotal");
                CamposPedido[3].Title = "SubTotal";
                CamposPedido[4]       = listaPedido.Fields.GetByInternalNameOrTitle("pedHistorialEstado");
                CamposPedido[4].Title = "Historial Estado";
                CamposPedido[5]       = listaPedido.Fields.GetByInternalNameOrTitle("pedHorario");
                CamposPedido[5].Title = "Horario";
                CamposPedido[6]       = listaPedido.Fields.GetByInternalNameOrTitle("pedBonificaciones");
                CamposPedido[6].Title = "Bonificaciones";
                CamposPedido[7]       = listaPedido.Fields.GetByInternalNameOrTitle("pedTotal");
                CamposPedido[7].Title = "Total";
                foreach (Field c in CamposPedido)
                {
                    c.Update();
                    cntF++;
                }
                ctx.ExecuteQuery();
                //Pedido Detalle --------------------------------------------------------------------------------------------
                Console.WriteLine("  Definiendo Campos de: {0} ", "Pedido Detalle");
                //Pedido Detalle cubiertos
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtCubiertos' "
                                                        + " ID='{0102837A-CB07-4C4F-9106-669C5BF92D79}' "
                                                        + " Name='peddtCubiertos' "
                                                        + " Type ='Boolean' >"
                                                        + " <Default>1</Default>"
                                                        + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Cubiertos");

                //Pedido Detalle aderezos
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtAderezos' "
                                                        + " ID='{CC120D44-8FF3-495A-9D13-208EDC5571B7}' "
                                                        + " Name='peddtAderezos' "
                                                        + " Type ='Choice' >"
                                                        + " <CHOICES>"
                                                        + "<CHOICE>Ninguno</CHOICE>"
                                                        + "<CHOICE>Mayonesa</CHOICE>"
                                                        + "<CHOICE>Ketechup</CHOICE>"
                                                        + "<CHOICE>Mostaza</CHOICE>"
                                                        + "<CHOICE>Sal</CHOICE>"
                                                        + "<CHOICE>Queso</CHOICE>"
                                                        + " </CHOICES>"
                                                        + " <Default>Ninguno</Default>"
                                                        + " </Field>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Aderezos");
                listaPedidoDetalle.Update();
                //Pedido Detalle cantidad
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtCantidad' "
                                                        + " ID='{AFD709FC-AF19-4EB1-A6A6-FD3F6E2B217A}' "
                                                        + " Name='peddtCantidad' "
                                                        + " Type ='Number'"
                                                        + " Min= '1' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Cantidad");

                //Pedido Detalle pan
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtPan' "
                                                        + " ID='{B16E25DB-0134-4ECD-A09C-1DC02CA0A56B}' "
                                                        + " Name='peddtPan' "
                                                        + " Type ='Boolean' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Pan");
                listaPedidoDetalle.Update();
                //Pedido Detalle Observaciones
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtObservaciones' "
                                                        + " ID='{9C446E32-69B3-4B8F-AD53-1E1A2648BC5C}' "
                                                        + " Name='peddtObservaciones' "
                                                        + " Type ='Note' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Observaciones");
                listaPedidoDetalle.Update();
                //Pedido Detalle usuario
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtUsuario' "
                                                        + " ID='{377B04EB-46F5-4A47-ABD8-C61EDD7169E4}' "
                                                        + " Name='peddtUsuario' "
                                                        + " Type ='User' "
                                                        + " Required='TRUE' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Usuario");
                listaPedidoDetalle.Update();
                //Pedido Detalle Id Pedido
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtIDPedido' "
                                                        + " ID='{F46E68EA-5F70-4023-9757-602DA9183652}' "
                                                        + " Name='peddtIDPedido' "
                                                        + " Type ='Number' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Id Pedido");
                listaPedidoDetalle.Update();
                //Pedido Detalle ID Guarnicion
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtIDGuarnicion' "
                                                        + " ID='{E7CCE4F2-099F-4E71-BDD1-3704A804D29D}' "
                                                        + " Name='peddtIDGuarnicion' "
                                                        + " Type ='Number' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Id Guarnicion");
                listaPedidoDetalle.Update();
                //Pedido Detalle  ID carta
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtIDCarta' "
                                                        + " ID='{CE032EC2-8E07-4353-9CBE-7D5B3E12E42A}' "
                                                        + " Name='peddtIDCarta' "
                                                        + " Type ='Number' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Id Carta");
                listaPedidoDetalle.Update();
                //Pedido Detalle Tipo Guarnicion
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtTituloGuarnicion' "
                                                        + " ID='{DEC90067-9289-4A9D-9D21-75E497974FEE}' "
                                                        + " Name='peddtTituloGuarnicion' "
                                                        + " Type ='Text' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Tipo Guarnicion");
                listaPedidoDetalle.Update();
                //Pedido Detalle SubTotal
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtSubTotal' "
                                                        + " ID='{5CB1ED9A-720B-4B74-AF3D-7B1D0FC7F999}' "
                                                        + " Name='peddtSubTotal' "
                                                        + " Type ='Currency' "
                                                        + " LCID= '11274'"
                                                        + " Min= '0' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Sub Total");

                //Pedido Detalle Bonificaciones
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtBonificaciones' "
                                                        + " ID='{F062E586-B859-4332-8B2F-9C4ECF2343DE}' "
                                                        + " Name='peddtTituloGuarnicion' "
                                                        + " Type ='Currency' "
                                                        + " LCID= '11274'/>", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Bonificaciones");
                listaPedidoDetalle.Update();
                //Pedido Detalle Total
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtTotal' "
                                                        + " ID='{A4A86576-1732-4DB9-9A02-45610E527A02}' "
                                                        + " Name='peddtTituloGuarnicion' "
                                                        + " Type ='Currency' "
                                                        + " LCID= '11274'"
                                                        + " Min= '0' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Total ");
                listaPedidoDetalle.Update();
                //Pedido Detalle Ingredientes
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtIngredientes' "
                                                        + " ID='{E981CE78-9608-43CA-AB9C-93F6FFAC7100}' "
                                                        + " Name='peddtIngredidentes' "
                                                        + " Type ='Note' />", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Ingredientes");
                listaPedidoDetalle.Update();
                ////Pedido Detalle Categoria ERROR
                listaPedidoDetalle.Fields.AddFieldAsXml("<Field DisplayName='peddtCategoria' "
                                                        + " ID='{2C9F202A-3934-48B4-9230-CAD91D9122C1}' "
                                                        + " Name='peddtCategoria' "
                                                        + " Type ='Text'/> ", true, AddFieldOptions.DefaultValue);
                Console.WriteLine("    -{0} ", "Categoria ");
                listaPedidoDetalle.Update();
                try
                {
                    ctx.ExecuteQuery();
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("    - EXISTENTE");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Field[] CamposPedidoD = new Field[15];
                CamposPedidoD[0]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtCubiertos");
                CamposPedidoD[0].Title = "Cubiertos";
                CamposPedidoD[1]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtAderezos");
                CamposPedidoD[1].Title = "Aderezos";
                CamposPedidoD[2]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtCantidad");
                CamposPedidoD[2].Title = "Cantidad";
                CamposPedidoD[3]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtPan");
                CamposPedidoD[3].Title = "Pan";
                CamposPedidoD[4]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtObservaciones");
                CamposPedidoD[4].Title = "Observaciones";

                CamposPedidoD[5]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtUsuario");
                CamposPedidoD[5].Title = "Usuario";
                CamposPedidoD[6]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtIDPedido");
                CamposPedidoD[6].Title = "ID Pedido";
                CamposPedidoD[7]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtIDGuarnicion");
                CamposPedidoD[7].Title = "ID Guarnición";
                CamposPedidoD[8]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtIDCarta");
                CamposPedidoD[8].Title = "ID Carta";
                CamposPedidoD[9]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtTituloGuarnicion");
                CamposPedidoD[9].Title = "Titulo Guarnición";

                CamposPedidoD[10]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtSubTotal");
                CamposPedidoD[10].Title = "SubTotal";
                CamposPedidoD[11]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtBonificaciones");
                CamposPedidoD[11].Title = "Bonificaciones";
                CamposPedidoD[12]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtTotal");
                CamposPedidoD[12].Title = "Total";
                CamposPedidoD[13]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtIngredientes");
                CamposPedidoD[13].Title = "Ingredientes";
                CamposPedidoD[14]       = listaPedidoDetalle.Fields.GetByInternalNameOrTitle("peddtCategoria");
                CamposPedidoD[14].Title = "Categoría";
                foreach (Field c in CamposPedidoD)
                {
                    c.Update();
                    cntF++;
                }
                ctx.ExecuteQuery();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("------- FIELDS CREADAS --------");
                Console.WriteLine("Cantidad de Fields configurados: " + cntF);
                Console.ResetColor();

                CrearPermisos PermisBuffet = new CrearPermisos("Buffet", "Buffet", usrUser, ctx);
                PermisBuffet.CrearGrupo();
                CrearPermisos PermisIntegrantes = new CrearPermisos("Integrantes", "Integrantes", usrUser, ctx);
                PermisIntegrantes.CrearGrupo();
                CrearPermisos PermisEmpresa = new CrearPermisos("Empresa", "Empresa", usrUser, ctx);
                PermisEmpresa.CrearGrupo();

                CrearPermisos.CrearNivel(ctx);
                CrearPermisos.AsignarPermis(ctx);
                CrearPermisoLista.AsignarPermiso(ctx);
                ActivarFeature.Activar(ctx);
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("\n ###### FIN ###### ");
            Console.WriteLine("\n         .-o=o-.");
            Console.WriteLine("       ,  /=o=o=o=\\ .--.");
            Console.WriteLine("      _|\\|=o=O=o=O=|    \\");
            Console.WriteLine("  __.'  a`\\=o=o=o=(`\\   /");
            Console.WriteLine("  '.   a 4/`|.-\"\"'`\\ \\ ;'`)   .---.");
            Console.WriteLine("    \\   .'  /   .--'  |_.'   / .-._)");
            Console.WriteLine("     `)  _.'   /     /`-.__.' /");
            Console.WriteLine("     `'-.____;     /'-.___.-'");
            Console.WriteLine("             `\"\"\"`')");
            Console.BackgroundColor = ConsoleColor.Green;
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Please Enter Site Address: ");
            string siteUrl      = Console.ReadLine();
            bool   siteOnline   = false;
            string siteUser     = "";
            string sitePassword = "";
            string siteDomain   = "";

            if (siteUrl.Contains(".sharepoint.com"))
            {
                Console.WriteLine("This site is SharePoint Online Right ? (Y/N): ");
                string OnlineAnswer = Console.ReadLine();

                if (OnlineAnswer.ToUpper() == "Y")
                {
                    siteOnline = true;
                }
            }

            if (siteOnline)
            {
                Console.WriteLine("Please Enter Site Login User Email Address: ");
                siteUser = Console.ReadLine();

                Console.WriteLine("Please Enter Site Login User Password: "******"Please Enter Site Login User Domain Name: ");
                siteDomain = Console.ReadLine();

                Console.WriteLine("Please Enter Site Login User Name: ");
                siteUser = Console.ReadLine();

                Console.WriteLine("Please Enter Site Login User Password: "******"Please Enter Master Page Gallery Name: ");
            string siteMasterPageGallery = Console.ReadLine();

            Console.WriteLine("Please Enter Create Publishing Page Content Type Display Name: ");
            string pageContentType = Console.ReadLine();

            Console.WriteLine("Please Enter Create Publishing Page Name: ");
            string pageName = Console.ReadLine();

            Console.WriteLine("Do You Have Add Page Field Value (Y/N): ");
            string addPageValuAnswer  = Console.ReadLine();
            bool   addPageValue       = false;
            string addPageValueString = "";

            if (addPageValuAnswer.ToUpper() == "Y")
            {
                addPageValue = true;
                Console.WriteLine("Please Enter Page Field Data ( ':' Separator Using For Field Name And Value, ';' Separator Using For Each Field Data ): ");
                Console.WriteLine("For Example ---> Title:TestPage;Comments:TestPage Comments ");
                Console.WriteLine("");
                addPageValueString = Console.ReadLine();
            }

            Console.WriteLine("Please Wait Start Create Process....");

            ClientContext  clientContext  = null;
            PublishingPage publishingPage = null;
            Web            web            = null;

            try
            {
                clientContext = new ClientContext(siteUrl);

                if (siteOnline)
                {
                    clientContext.AuthenticationMode = ClientAuthenticationMode.Default;

                    string password = sitePassword;
                    System.Security.SecureString passwordChar = new System.Security.SecureString();
                    foreach (char ch in password)
                    {
                        passwordChar.AppendChar(ch);
                    }

                    clientContext.Credentials = new SharePointOnlineCredentials(siteUser, passwordChar);
                }
                else
                {
                    clientContext.Credentials = new NetworkCredential(siteUser, sitePassword, siteDomain);
                }

                web = clientContext.Web;
                clientContext.Load(web);
                clientContext.ExecuteQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine("This Site Connect Error Please Check Your Information And Try Again");
                Console.WriteLine("Error Message: " + ex.Message);
                Console.ReadLine();
                Environment.Exit(0);
            }

            try
            {
                Console.WriteLine("This Site Connection Success....");
                Console.WriteLine("Please Wait Create Publishing Page.....");

                List publishingLayouts      = clientContext.Site.RootWeb.Lists.GetByTitle(siteMasterPageGallery);
                ListItemCollection allItems = publishingLayouts.GetItems(CamlQuery.CreateAllItemsQuery());
                clientContext.Load(allItems, items => items.Include(item => item.DisplayName).Where(obj => obj.DisplayName == pageContentType));
                clientContext.ExecuteQuery();
                ListItem layout = allItems.Where(x => x.DisplayName == pageContentType).FirstOrDefault();
                clientContext.Load(layout);

                PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(clientContext, web);
                clientContext.Load(publishingWeb);

                PublishingPageInformation publishingPageInfo = new PublishingPageInformation();
                publishingPageInfo.Name = pageName.Contains(".aspx") ? pageName : pageName + ".aspx";
                publishingPageInfo.PageLayoutListItem = layout;

                publishingPage = publishingWeb.AddPublishingPage(publishingPageInfo);

                clientContext.Load(publishingPage);
                clientContext.Load(publishingPage.ListItem.File);
                clientContext.ExecuteQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine("This During Publishing Page Error Please Check Your Information And Try Again");
                Console.WriteLine("Error Message: " + ex.Message);
                Console.ReadLine();
                Environment.Exit(0);
            }

            Console.WriteLine("this Publishing Page Create Success....");

            if (addPageValue)
            {
                try
                {
                    Console.WriteLine("Please Wait Add Field Data Publishing Page....");

                    ListItem listItem = publishingPage.ListItem;

                    string[] dataArray = addPageValueString.Split(';');

                    foreach (string data in dataArray)
                    {
                        listItem[data.Split(':')[0]] = data.Split(':')[1];
                    }

                    listItem.Update();

                    publishingPage.ListItem.File.CheckIn(string.Empty, CheckinType.MajorCheckIn);
                    publishingPage.ListItem.File.Publish(string.Empty);

                    clientContext.Load(publishingPage);

                    clientContext.ExecuteQuery();

                    Console.WriteLine("Tihs Publishing Page Add Field Data Success....");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("This During Publishing Page Add Field Data Error Please Check Your Information And Try Again");
                    Console.WriteLine("Error Message: " + ex.Message);
                    Console.ReadLine();
                    Environment.Exit(0);
                }
            }

            Console.WriteLine("All Process Complete Success...");
            Console.ReadLine();
            Environment.Exit(0);
        }
Example #53
0
 private static byte[] GetData(System.Security.SecureString s)
 {
     System.Reflection.FieldInfo fi = s.GetType().GetField("data", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
     return((byte[])fi.GetValue(s));
 }
Example #54
0
 public NetworkCredential(string userName, System.Security.SecureString password, string domain)
 {
 }
Example #55
0
 public static Exception Impersonate(string aUserName, string aDomainName, string aPass)
 {
     System.Security.SecureString s = new System.Security.SecureString();
     foreach (char c in aPass) s.AppendChar(c);
     return Impersonate(aUserName, aDomainName, s);
 }
        private string ExecuteRemote(string PowershellTimeOut, string HostName, string UserName, string Password, string PsrPort, string UriType, string ScriptCode, string ScriptPath, string HasParams, string TableAsString)
        {
            string  Argument = string.Empty;
            string  sTxtResult;
            Process myProcess = new Process();

            try
            {
                Argument = PowershellTimeOut + " " + (string.IsNullOrEmpty(HostName) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(HostName)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(UserName) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(UserName)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(Password) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(Password)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(PsrPort) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(PsrPort)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(UriType) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(UriType)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(ScriptCode) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(ScriptCode)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(ScriptPath) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(ScriptPath)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(HasParams) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(HasParams)) : "Null") + " ";
                Argument = Argument + (string.IsNullOrEmpty(TableAsString) == false ? System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(TableAsString)) : "Null") + " ";

                Argument = Argument.TrimEnd();
                myProcess.StartInfo.FileName  = @"AyehuPowerShellAgent.exe";
                myProcess.StartInfo.Arguments = Argument;
                System.Security.SecureString sstr = new System.Security.SecureString();
                myProcess.StartInfo.UseShellExecute        = false;
                myProcess.StartInfo.CreateNoWindow         = true;
                myProcess.StartInfo.RedirectStandardInput  = true;
                myProcess.StartInfo.RedirectStandardOutput = true;
                myProcess.StartInfo.RedirectStandardError  = true;
                myProcess.Start();
                StreamWriter sIn  = myProcess.StandardInput;
                StreamReader sOut = myProcess.StandardOutput;
                StreamReader sErr = myProcess.StandardError;

                sIn.AutoFlush = true;
                sIn.Write(("exit" + System.Environment.NewLine));
                string err = "";
                sTxtResult = sOut.ReadToEnd();

                if (((string.IsNullOrEmpty(sTxtResult) == true) && (string.IsNullOrEmpty(err) == false)))
                {
                    if (err.Contains("Program\' is not recognized as an internal or external command"))
                    {
                        err = (err + ("\r\n" + ("\r\n" + ("Phrases with spaces should be encapsulated with double quotes." + "\r\n"))));
                    }

                    throw new Exception(err);
                }

                myProcess.WaitForExit(60000);
                double   timetowait = 60;
                DateTime exittime;
                exittime = DateTime.Now.AddSeconds(timetowait);

                if (!myProcess.HasExited)
                {
                    myProcess.Kill();
                }

                sIn.Close();
                sOut.Close();
                sErr.Close();
                myProcess.Close();

                if (sTxtResult.ToLower().IndexOf("error: ") == 0)
                {
                    throw new Exception(sTxtResult.Substring(7));
                }
            }
            catch (ThreadAbortException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }

            return(sTxtResult);
        }
Example #57
0
        /// <summary>
        /// Decrypts the specified data using a 256-bit cipher. The key can be any length.
        /// </summary>
        /// <param name="Data">The data to be decrypted. Will be converted to UTF8.</param>
        /// <param name="Key">The key used to decrypt the data.</param>
        /// <returns>A string containing the decoded data.</returns>
        public static System.Security.SecureString Decrypt256StringSecure(Stream Data, byte[] Key)
        {
            RijndaelManaged AES = null;
            CryptoStream CS = null;
            StreamReader DS = null;
            try
            {
                //Get the IV and length corrected Key.
                KeyData KeyData = GenerateKeyIV128(Key);
                //Create the AES crytpograhy object.
                AES = new RijndaelManaged { BlockSize = 256, KeySize = 256, Key = KeyData.Key, IV = KeyData.IV, Mode = CipherMode.CBC, Padding = PaddingMode.PKCS7 };
                CS = new CryptoStream(Data, AES.CreateDecryptor(), CryptoStreamMode.Read);
                DS = new StreamReader(CS);

                var ss = new System.Security.SecureString();
                while (DS.EndOfStream == false)
                    ss.AppendChar(Convert.ToChar(DS.Read()));
                ss.MakeReadOnly();
                return ss;
            }
            finally
            {
                if (AES != null) AES.Clear();
                if (CS != null) CS.Dispose();
                if (DS != null) DS.Dispose();
            }
        }
Example #58
0
 public static DllInjector CreateProcess(string FileName, string Arguments, string UserName, System.Security.SecureString Password, string Domain, bool CreateSuspended = false, bool FreeOnDispose = false)
 {
     return(CreateProcess(new ProcessStartInfo(FileName, Arguments)
     {
         UserName = UserName,
         Password = Password,
         Domain = Domain
     }, CreateSuspended, FreeOnDispose));
 }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Security.SecureString secureString1 = new System.Security.SecureString();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectionWindow));
            this.rdcLabel1 = new System.Windows.Forms.Label();
            this.rdcLabel2 = new System.Windows.Forms.Label();
            this.tabControl = new System.Windows.Forms.TabControl();
            this.generalTabPage = new System.Windows.Forms.TabPage();
            this.connectionSettingsGroupBox = new System.Windows.Forms.GroupBox();
            this.saveAsButton = new System.Windows.Forms.Button();
            this.saveButton = new System.Windows.Forms.Button();
            this.saveLabel = new System.Windows.Forms.Label();
            this.logonSettingsGroupBox = new System.Windows.Forms.GroupBox();
            this.passwordLabel = new System.Windows.Forms.Label();
            this.usernameTextBox = new System.Windows.Forms.TextBox();
            this.userNameLabel = new System.Windows.Forms.Label();
            this.logonInstructionsLabel = new System.Windows.Forms.Label();
            this.computerLabel = new System.Windows.Forms.Label();
            this.hostBox = new System.Windows.Forms.ComboBox();
            this.displayTabPage = new System.Windows.Forms.TabPage();
            this.colorDepthGroupBox = new System.Windows.Forms.GroupBox();
            this.colorDepthDropdown = new System.Windows.Forms.ComboBox();
            this.colorDepthLabel = new System.Windows.Forms.Label();
            this.displayConfigurationGroupBox = new System.Windows.Forms.GroupBox();
            this.resolutionLabel = new System.Windows.Forms.Label();
            this.largeLabel = new System.Windows.Forms.Label();
            this.smallLabel = new System.Windows.Forms.Label();
            this.resolutionTrackBar = new System.Windows.Forms.TrackBar();
            this.displayConfigurationLabel = new System.Windows.Forms.Label();
            this.localResourcesTabPage = new System.Windows.Forms.TabPage();
            this.localDevicesGroupBox = new System.Windows.Forms.GroupBox();
            this.drivesCheckBox = new System.Windows.Forms.CheckBox();
            this.clipboardCheckBox = new System.Windows.Forms.CheckBox();
            this.printersCheckBox = new System.Windows.Forms.CheckBox();
            this.resourcesLabel = new System.Windows.Forms.Label();
            this.keyboardGroupBox = new System.Windows.Forms.GroupBox();
            this.keyboardDropdown = new System.Windows.Forms.ComboBox();
            this.keyboardLabel = new System.Windows.Forms.Label();
            this.remoteAudioGroupBox = new System.Windows.Forms.GroupBox();
            this.playRemotelyRadioButton = new System.Windows.Forms.RadioButton();
            this.dontPlayRadioButton = new System.Windows.Forms.RadioButton();
            this.playLocallyRadioButton = new System.Windows.Forms.RadioButton();
            this.experienceTab = new System.Windows.Forms.TabPage();
            this.performanceGroupBox = new System.Windows.Forms.GroupBox();
            this.bitmapCachingCheckBox = new System.Windows.Forms.CheckBox();
            this.visualStylesCheckBox = new System.Windows.Forms.CheckBox();
            this.animationCheckBox = new System.Windows.Forms.CheckBox();
            this.windowContentsCheckBox = new System.Windows.Forms.CheckBox();
            this.desktopCompositionCheckBox = new System.Windows.Forms.CheckBox();
            this.fontSmoothingCheckBox = new System.Windows.Forms.CheckBox();
            this.performanceLabel = new System.Windows.Forms.Label();
            this.desktopBackgroundCheckBox = new System.Windows.Forms.CheckBox();
            this.connectButton = new System.Windows.Forms.Button();
            this.radioButton1 = new System.Windows.Forms.RadioButton();
            this.radioButton2 = new System.Windows.Forms.RadioButton();
            this.radioButton3 = new System.Windows.Forms.RadioButton();
            this.rdcImage = new System.Windows.Forms.PictureBox();
            this.gradientBackground = new System.Windows.Forms.PictureBox();
            this.pictureBox2 = new System.Windows.Forms.PictureBox();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.pictureBox4 = new System.Windows.Forms.PictureBox();
            this.pictureBox3 = new System.Windows.Forms.PictureBox();
            this.pictureBox6 = new System.Windows.Forms.PictureBox();
            this.pictureBox5 = new System.Windows.Forms.PictureBox();
            this.audioPictureBox = new System.Windows.Forms.PictureBox();
            this.pictureBox8 = new System.Windows.Forms.PictureBox();
            this.pictureBox7 = new System.Windows.Forms.PictureBox();
            this.passwordTextBox = new SecurePasswordTextBox.SecureTextBox();
            this.tabControl.SuspendLayout();
            this.generalTabPage.SuspendLayout();
            this.connectionSettingsGroupBox.SuspendLayout();
            this.logonSettingsGroupBox.SuspendLayout();
            this.displayTabPage.SuspendLayout();
            this.colorDepthGroupBox.SuspendLayout();
            this.displayConfigurationGroupBox.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.resolutionTrackBar)).BeginInit();
            this.localResourcesTabPage.SuspendLayout();
            this.localDevicesGroupBox.SuspendLayout();
            this.keyboardGroupBox.SuspendLayout();
            this.remoteAudioGroupBox.SuspendLayout();
            this.experienceTab.SuspendLayout();
            this.performanceGroupBox.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.rdcImage)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gradientBackground)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.audioPictureBox)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
            this.SuspendLayout();
            // 
            // rdcLabel1
            // 
            this.rdcLabel1.AutoSize = true;
            this.rdcLabel1.BackColor = System.Drawing.Color.Transparent;
            this.rdcLabel1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.rdcLabel1.ForeColor = System.Drawing.Color.Navy;
            this.rdcLabel1.Location = new System.Drawing.Point(94, 23);
            this.rdcLabel1.Name = "rdcLabel1";
            this.rdcLabel1.Size = new System.Drawing.Size(171, 25);
            this.rdcLabel1.TabIndex = 1;
            this.rdcLabel1.Text = "Remote Desktop";
            // 
            // rdcLabel2
            // 
            this.rdcLabel2.AutoSize = true;
            this.rdcLabel2.BackColor = System.Drawing.Color.Transparent;
            this.rdcLabel2.Font = new System.Drawing.Font("Arial Black", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.rdcLabel2.ForeColor = System.Drawing.Color.Navy;
            this.rdcLabel2.Location = new System.Drawing.Point(92, 41);
            this.rdcLabel2.Name = "rdcLabel2";
            this.rdcLabel2.Size = new System.Drawing.Size(165, 33);
            this.rdcLabel2.TabIndex = 2;
            this.rdcLabel2.Text = "Connection";
            // 
            // tabControl
            // 
            this.tabControl.Controls.Add(this.generalTabPage);
            this.tabControl.Controls.Add(this.displayTabPage);
            this.tabControl.Controls.Add(this.localResourcesTabPage);
            this.tabControl.Controls.Add(this.experienceTab);
            this.tabControl.Location = new System.Drawing.Point(12, 107);
            this.tabControl.Name = "tabControl";
            this.tabControl.SelectedIndex = 0;
            this.tabControl.Size = new System.Drawing.Size(380, 316);
            this.tabControl.TabIndex = 4;
            // 
            // generalTabPage
            // 
            this.generalTabPage.Controls.Add(this.connectionSettingsGroupBox);
            this.generalTabPage.Controls.Add(this.logonSettingsGroupBox);
            this.generalTabPage.Location = new System.Drawing.Point(4, 22);
            this.generalTabPage.Name = "generalTabPage";
            this.generalTabPage.Padding = new System.Windows.Forms.Padding(3);
            this.generalTabPage.Size = new System.Drawing.Size(372, 290);
            this.generalTabPage.TabIndex = 0;
            this.generalTabPage.Text = "General";
            this.generalTabPage.UseVisualStyleBackColor = true;
            // 
            // connectionSettingsGroupBox
            // 
            this.connectionSettingsGroupBox.Controls.Add(this.saveAsButton);
            this.connectionSettingsGroupBox.Controls.Add(this.saveButton);
            this.connectionSettingsGroupBox.Controls.Add(this.saveLabel);
            this.connectionSettingsGroupBox.Controls.Add(this.pictureBox2);
            this.connectionSettingsGroupBox.Location = new System.Drawing.Point(7, 158);
            this.connectionSettingsGroupBox.Name = "connectionSettingsGroupBox";
            this.connectionSettingsGroupBox.Size = new System.Drawing.Size(359, 83);
            this.connectionSettingsGroupBox.TabIndex = 1;
            this.connectionSettingsGroupBox.TabStop = false;
            this.connectionSettingsGroupBox.Text = "Connection settings";
            // 
            // saveAsButton
            // 
            this.saveAsButton.Location = new System.Drawing.Point(180, 41);
            this.saveAsButton.Name = "saveAsButton";
            this.saveAsButton.Size = new System.Drawing.Size(88, 23);
            this.saveAsButton.TabIndex = 3;
            this.saveAsButton.Text = "Save As...";
            this.saveAsButton.UseVisualStyleBackColor = true;
            this.saveAsButton.Click += new System.EventHandler(this.saveAsButton_Click);
            // 
            // saveButton
            // 
            this.saveButton.Location = new System.Drawing.Point(86, 41);
            this.saveButton.Name = "saveButton";
            this.saveButton.Size = new System.Drawing.Size(88, 23);
            this.saveButton.TabIndex = 2;
            this.saveButton.Text = "Save";
            this.saveButton.UseVisualStyleBackColor = true;
            this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
            // 
            // saveLabel
            // 
            this.saveLabel.AutoSize = true;
            this.saveLabel.Location = new System.Drawing.Point(83, 20);
            this.saveLabel.Name = "saveLabel";
            this.saveLabel.Size = new System.Drawing.Size(184, 13);
            this.saveLabel.TabIndex = 1;
            this.saveLabel.Text = "Save the current connection settings.";
            // 
            // logonSettingsGroupBox
            // 
            this.logonSettingsGroupBox.Controls.Add(this.passwordTextBox);
            this.logonSettingsGroupBox.Controls.Add(this.passwordLabel);
            this.logonSettingsGroupBox.Controls.Add(this.usernameTextBox);
            this.logonSettingsGroupBox.Controls.Add(this.userNameLabel);
            this.logonSettingsGroupBox.Controls.Add(this.logonInstructionsLabel);
            this.logonSettingsGroupBox.Controls.Add(this.pictureBox1);
            this.logonSettingsGroupBox.Controls.Add(this.computerLabel);
            this.logonSettingsGroupBox.Controls.Add(this.hostBox);
            this.logonSettingsGroupBox.Location = new System.Drawing.Point(7, 7);
            this.logonSettingsGroupBox.Name = "logonSettingsGroupBox";
            this.logonSettingsGroupBox.Size = new System.Drawing.Size(359, 144);
            this.logonSettingsGroupBox.TabIndex = 0;
            this.logonSettingsGroupBox.TabStop = false;
            this.logonSettingsGroupBox.Text = "Logon settings";
            // 
            // passwordLabel
            // 
            this.passwordLabel.AutoSize = true;
            this.passwordLabel.Location = new System.Drawing.Point(83, 105);
            this.passwordLabel.Name = "passwordLabel";
            this.passwordLabel.Size = new System.Drawing.Size(56, 13);
            this.passwordLabel.TabIndex = 6;
            this.passwordLabel.Text = "Password:"******"usernameTextBox";
            this.usernameTextBox.Size = new System.Drawing.Size(168, 20);
            this.usernameTextBox.TabIndex = 5;
            // 
            // userNameLabel
            // 
            this.userNameLabel.AutoSize = true;
            this.userNameLabel.Location = new System.Drawing.Point(83, 76);
            this.userNameLabel.Name = "userNameLabel";
            this.userNameLabel.Size = new System.Drawing.Size(61, 13);
            this.userNameLabel.TabIndex = 4;
            this.userNameLabel.Text = "User name:";
            // 
            // logonInstructionsLabel
            // 
            this.logonInstructionsLabel.AutoSize = true;
            this.logonInstructionsLabel.Location = new System.Drawing.Point(83, 19);
            this.logonInstructionsLabel.Name = "logonInstructionsLabel";
            this.logonInstructionsLabel.Size = new System.Drawing.Size(194, 13);
            this.logonInstructionsLabel.TabIndex = 3;
            this.logonInstructionsLabel.Text = "Enter the name of the remote computer.";
            // 
            // computerLabel
            // 
            this.computerLabel.AutoSize = true;
            this.computerLabel.Location = new System.Drawing.Point(83, 47);
            this.computerLabel.Name = "computerLabel";
            this.computerLabel.Size = new System.Drawing.Size(55, 13);
            this.computerLabel.TabIndex = 1;
            this.computerLabel.Text = "Computer:";
            // 
            // hostBox
            // 
            this.hostBox.FormattingEnabled = true;
            this.hostBox.Location = new System.Drawing.Point(169, 44);
            this.hostBox.Name = "hostBox";
            this.hostBox.Size = new System.Drawing.Size(168, 21);
            this.hostBox.TabIndex = 0;
            // 
            // displayTabPage
            // 
            this.displayTabPage.Controls.Add(this.colorDepthGroupBox);
            this.displayTabPage.Controls.Add(this.displayConfigurationGroupBox);
            this.displayTabPage.Location = new System.Drawing.Point(4, 22);
            this.displayTabPage.Name = "displayTabPage";
            this.displayTabPage.Padding = new System.Windows.Forms.Padding(3);
            this.displayTabPage.Size = new System.Drawing.Size(372, 290);
            this.displayTabPage.TabIndex = 1;
            this.displayTabPage.Text = "Display";
            this.displayTabPage.UseVisualStyleBackColor = true;
            // 
            // colorDepthGroupBox
            // 
            this.colorDepthGroupBox.Controls.Add(this.colorDepthDropdown);
            this.colorDepthGroupBox.Controls.Add(this.colorDepthLabel);
            this.colorDepthGroupBox.Controls.Add(this.pictureBox4);
            this.colorDepthGroupBox.Location = new System.Drawing.Point(7, 138);
            this.colorDepthGroupBox.Name = "colorDepthGroupBox";
            this.colorDepthGroupBox.Size = new System.Drawing.Size(359, 81);
            this.colorDepthGroupBox.TabIndex = 1;
            this.colorDepthGroupBox.TabStop = false;
            this.colorDepthGroupBox.Text = "Colors";
            // 
            // colorDepthDropdown
            // 
            this.colorDepthDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.colorDepthDropdown.FormattingEnabled = true;
            this.colorDepthDropdown.Items.AddRange(new object[] {
            "High color (15 bit)",
            "High color (16 bit)",
            "True color (24 bit)",
            "Highest quality (32 bit)"});
            this.colorDepthDropdown.Location = new System.Drawing.Point(79, 42);
            this.colorDepthDropdown.Name = "colorDepthDropdown";
            this.colorDepthDropdown.Size = new System.Drawing.Size(134, 21);
            this.colorDepthDropdown.TabIndex = 2;
            // 
            // colorDepthLabel
            // 
            this.colorDepthLabel.AutoSize = true;
            this.colorDepthLabel.Location = new System.Drawing.Point(76, 19);
            this.colorDepthLabel.Name = "colorDepthLabel";
            this.colorDepthLabel.Size = new System.Drawing.Size(223, 13);
            this.colorDepthLabel.TabIndex = 1;
            this.colorDepthLabel.Text = "Choose the color depth of the remote session.";
            // 
            // displayConfigurationGroupBox
            // 
            this.displayConfigurationGroupBox.Controls.Add(this.resolutionLabel);
            this.displayConfigurationGroupBox.Controls.Add(this.largeLabel);
            this.displayConfigurationGroupBox.Controls.Add(this.smallLabel);
            this.displayConfigurationGroupBox.Controls.Add(this.resolutionTrackBar);
            this.displayConfigurationGroupBox.Controls.Add(this.displayConfigurationLabel);
            this.displayConfigurationGroupBox.Controls.Add(this.pictureBox3);
            this.displayConfigurationGroupBox.Location = new System.Drawing.Point(7, 7);
            this.displayConfigurationGroupBox.Name = "displayConfigurationGroupBox";
            this.displayConfigurationGroupBox.Size = new System.Drawing.Size(359, 124);
            this.displayConfigurationGroupBox.TabIndex = 0;
            this.displayConfigurationGroupBox.TabStop = false;
            this.displayConfigurationGroupBox.Text = "Display configuration";
            // 
            // resolutionLabel
            // 
            this.resolutionLabel.Location = new System.Drawing.Point(121, 98);
            this.resolutionLabel.Name = "resolutionLabel";
            this.resolutionLabel.Size = new System.Drawing.Size(171, 17);
            this.resolutionLabel.TabIndex = 5;
            this.resolutionLabel.Text = "Full Screen";
            this.resolutionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // largeLabel
            // 
            this.largeLabel.AutoSize = true;
            this.largeLabel.Location = new System.Drawing.Point(312, 67);
            this.largeLabel.Name = "largeLabel";
            this.largeLabel.Size = new System.Drawing.Size(34, 13);
            this.largeLabel.TabIndex = 4;
            this.largeLabel.Text = "Large";
            // 
            // smallLabel
            // 
            this.smallLabel.AutoSize = true;
            this.smallLabel.Location = new System.Drawing.Point(76, 67);
            this.smallLabel.Name = "smallLabel";
            this.smallLabel.Size = new System.Drawing.Size(32, 13);
            this.smallLabel.TabIndex = 3;
            this.smallLabel.Text = "Small";
            // 
            // resolutionTrackBar
            // 
            this.resolutionTrackBar.BackColor = System.Drawing.SystemColors.Window;
            this.resolutionTrackBar.Location = new System.Drawing.Point(124, 67);
            this.resolutionTrackBar.Name = "resolutionTrackBar";
            this.resolutionTrackBar.Size = new System.Drawing.Size(171, 45);
            this.resolutionTrackBar.TabIndex = 2;
            this.resolutionTrackBar.Value = 10;
            this.resolutionTrackBar.ValueChanged += new System.EventHandler(this.resolutionTrackBar_ValueChanged);
            // 
            // displayConfigurationLabel
            // 
            this.displayConfigurationLabel.AutoSize = true;
            this.displayConfigurationLabel.Location = new System.Drawing.Point(76, 23);
            this.displayConfigurationLabel.Name = "displayConfigurationLabel";
            this.displayConfigurationLabel.Size = new System.Drawing.Size(273, 26);
            this.displayConfigurationLabel.TabIndex = 1;
            this.displayConfigurationLabel.Text = "Choose the size of your remote desktop.  Drag the slider \r\nall the way to the rig" +
                "ht to use the full screen.";
            // 
            // localResourcesTabPage
            // 
            this.localResourcesTabPage.Controls.Add(this.localDevicesGroupBox);
            this.localResourcesTabPage.Controls.Add(this.keyboardGroupBox);
            this.localResourcesTabPage.Controls.Add(this.remoteAudioGroupBox);
            this.localResourcesTabPage.Location = new System.Drawing.Point(4, 22);
            this.localResourcesTabPage.Name = "localResourcesTabPage";
            this.localResourcesTabPage.Size = new System.Drawing.Size(372, 290);
            this.localResourcesTabPage.TabIndex = 2;
            this.localResourcesTabPage.Text = "Local Resources";
            this.localResourcesTabPage.UseVisualStyleBackColor = true;
            // 
            // localDevicesGroupBox
            // 
            this.localDevicesGroupBox.Controls.Add(this.drivesCheckBox);
            this.localDevicesGroupBox.Controls.Add(this.clipboardCheckBox);
            this.localDevicesGroupBox.Controls.Add(this.printersCheckBox);
            this.localDevicesGroupBox.Controls.Add(this.resourcesLabel);
            this.localDevicesGroupBox.Controls.Add(this.pictureBox6);
            this.localDevicesGroupBox.Location = new System.Drawing.Point(7, 197);
            this.localDevicesGroupBox.Name = "localDevicesGroupBox";
            this.localDevicesGroupBox.Size = new System.Drawing.Size(359, 87);
            this.localDevicesGroupBox.TabIndex = 5;
            this.localDevicesGroupBox.TabStop = false;
            this.localDevicesGroupBox.Text = "Local devices and resources";
            // 
            // drivesCheckBox
            // 
            this.drivesCheckBox.AutoSize = true;
            this.drivesCheckBox.Location = new System.Drawing.Point(235, 59);
            this.drivesCheckBox.Name = "drivesCheckBox";
            this.drivesCheckBox.Size = new System.Drawing.Size(56, 17);
            this.drivesCheckBox.TabIndex = 7;
            this.drivesCheckBox.Text = "Drives";
            this.drivesCheckBox.UseVisualStyleBackColor = true;
            // 
            // clipboardCheckBox
            // 
            this.clipboardCheckBox.AutoSize = true;
            this.clipboardCheckBox.Checked = true;
            this.clipboardCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.clipboardCheckBox.Location = new System.Drawing.Point(146, 59);
            this.clipboardCheckBox.Name = "clipboardCheckBox";
            this.clipboardCheckBox.Size = new System.Drawing.Size(70, 17);
            this.clipboardCheckBox.TabIndex = 6;
            this.clipboardCheckBox.Text = "Clipboard";
            this.clipboardCheckBox.UseVisualStyleBackColor = true;
            // 
            // printersCheckBox
            // 
            this.printersCheckBox.AutoSize = true;
            this.printersCheckBox.Checked = true;
            this.printersCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.printersCheckBox.Location = new System.Drawing.Point(68, 59);
            this.printersCheckBox.Name = "printersCheckBox";
            this.printersCheckBox.Size = new System.Drawing.Size(61, 17);
            this.printersCheckBox.TabIndex = 5;
            this.printersCheckBox.Text = "Printers";
            this.printersCheckBox.UseVisualStyleBackColor = true;
            // 
            // resourcesLabel
            // 
            this.resourcesLabel.AutoSize = true;
            this.resourcesLabel.Location = new System.Drawing.Point(65, 23);
            this.resourcesLabel.Name = "resourcesLabel";
            this.resourcesLabel.Size = new System.Drawing.Size(281, 26);
            this.resourcesLabel.TabIndex = 4;
            this.resourcesLabel.Text = "Choose the devices and resources that you want to use in\r\nyour remote session.";
            // 
            // keyboardGroupBox
            // 
            this.keyboardGroupBox.Controls.Add(this.keyboardDropdown);
            this.keyboardGroupBox.Controls.Add(this.keyboardLabel);
            this.keyboardGroupBox.Controls.Add(this.pictureBox5);
            this.keyboardGroupBox.Location = new System.Drawing.Point(7, 110);
            this.keyboardGroupBox.Name = "keyboardGroupBox";
            this.keyboardGroupBox.Size = new System.Drawing.Size(359, 81);
            this.keyboardGroupBox.TabIndex = 4;
            this.keyboardGroupBox.TabStop = false;
            this.keyboardGroupBox.Text = "Keyboard";
            // 
            // keyboardDropdown
            // 
            this.keyboardDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.keyboardDropdown.FormattingEnabled = true;
            this.keyboardDropdown.Items.AddRange(new object[] {
            "On this computer",
            "On the remote computer"});
            this.keyboardDropdown.Location = new System.Drawing.Point(79, 42);
            this.keyboardDropdown.Name = "keyboardDropdown";
            this.keyboardDropdown.Size = new System.Drawing.Size(182, 21);
            this.keyboardDropdown.TabIndex = 5;
            // 
            // keyboardLabel
            // 
            this.keyboardLabel.AutoSize = true;
            this.keyboardLabel.Location = new System.Drawing.Point(76, 20);
            this.keyboardLabel.Name = "keyboardLabel";
            this.keyboardLabel.Size = new System.Drawing.Size(168, 13);
            this.keyboardLabel.TabIndex = 4;
            this.keyboardLabel.Text = "Apply Windows key combinations:";
            // 
            // remoteAudioGroupBox
            // 
            this.remoteAudioGroupBox.Controls.Add(this.audioPictureBox);
            this.remoteAudioGroupBox.Controls.Add(this.playRemotelyRadioButton);
            this.remoteAudioGroupBox.Controls.Add(this.dontPlayRadioButton);
            this.remoteAudioGroupBox.Controls.Add(this.playLocallyRadioButton);
            this.remoteAudioGroupBox.Location = new System.Drawing.Point(7, 7);
            this.remoteAudioGroupBox.Name = "remoteAudioGroupBox";
            this.remoteAudioGroupBox.Size = new System.Drawing.Size(359, 97);
            this.remoteAudioGroupBox.TabIndex = 0;
            this.remoteAudioGroupBox.TabStop = false;
            this.remoteAudioGroupBox.Text = "Remote audio";
            // 
            // playRemotelyRadioButton
            // 
            this.playRemotelyRadioButton.AutoSize = true;
            this.playRemotelyRadioButton.Location = new System.Drawing.Point(78, 65);
            this.playRemotelyRadioButton.Name = "playRemotelyRadioButton";
            this.playRemotelyRadioButton.Size = new System.Drawing.Size(142, 17);
            this.playRemotelyRadioButton.TabIndex = 2;
            this.playRemotelyRadioButton.Text = "Play on remote computer";
            this.playRemotelyRadioButton.UseVisualStyleBackColor = true;
            // 
            // dontPlayRadioButton
            // 
            this.dontPlayRadioButton.AutoSize = true;
            this.dontPlayRadioButton.Location = new System.Drawing.Point(78, 42);
            this.dontPlayRadioButton.Name = "dontPlayRadioButton";
            this.dontPlayRadioButton.Size = new System.Drawing.Size(79, 17);
            this.dontPlayRadioButton.TabIndex = 1;
            this.dontPlayRadioButton.Text = "Do not play";
            this.dontPlayRadioButton.UseVisualStyleBackColor = true;
            // 
            // playLocallyRadioButton
            // 
            this.playLocallyRadioButton.AutoSize = true;
            this.playLocallyRadioButton.Checked = true;
            this.playLocallyRadioButton.Location = new System.Drawing.Point(78, 19);
            this.playLocallyRadioButton.Name = "playLocallyRadioButton";
            this.playLocallyRadioButton.Size = new System.Drawing.Size(126, 17);
            this.playLocallyRadioButton.TabIndex = 0;
            this.playLocallyRadioButton.TabStop = true;
            this.playLocallyRadioButton.Text = "Play on this computer";
            this.playLocallyRadioButton.UseVisualStyleBackColor = true;
            // 
            // experienceTab
            // 
            this.experienceTab.Controls.Add(this.performanceGroupBox);
            this.experienceTab.Location = new System.Drawing.Point(4, 22);
            this.experienceTab.Name = "experienceTab";
            this.experienceTab.Padding = new System.Windows.Forms.Padding(3);
            this.experienceTab.Size = new System.Drawing.Size(372, 290);
            this.experienceTab.TabIndex = 3;
            this.experienceTab.Text = "Experience";
            this.experienceTab.UseVisualStyleBackColor = true;
            // 
            // performanceGroupBox
            // 
            this.performanceGroupBox.Controls.Add(this.bitmapCachingCheckBox);
            this.performanceGroupBox.Controls.Add(this.visualStylesCheckBox);
            this.performanceGroupBox.Controls.Add(this.animationCheckBox);
            this.performanceGroupBox.Controls.Add(this.windowContentsCheckBox);
            this.performanceGroupBox.Controls.Add(this.desktopCompositionCheckBox);
            this.performanceGroupBox.Controls.Add(this.fontSmoothingCheckBox);
            this.performanceGroupBox.Controls.Add(this.performanceLabel);
            this.performanceGroupBox.Controls.Add(this.desktopBackgroundCheckBox);
            this.performanceGroupBox.Controls.Add(this.pictureBox8);
            this.performanceGroupBox.Location = new System.Drawing.Point(7, 7);
            this.performanceGroupBox.Name = "performanceGroupBox";
            this.performanceGroupBox.Size = new System.Drawing.Size(359, 220);
            this.performanceGroupBox.TabIndex = 1;
            this.performanceGroupBox.TabStop = false;
            this.performanceGroupBox.Text = "Performance";
            // 
            // bitmapCachingCheckBox
            // 
            this.bitmapCachingCheckBox.AutoSize = true;
            this.bitmapCachingCheckBox.Checked = true;
            this.bitmapCachingCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.bitmapCachingCheckBox.Location = new System.Drawing.Point(76, 187);
            this.bitmapCachingCheckBox.Name = "bitmapCachingCheckBox";
            this.bitmapCachingCheckBox.Size = new System.Drawing.Size(147, 17);
            this.bitmapCachingCheckBox.TabIndex = 11;
            this.bitmapCachingCheckBox.Text = "Persistent bitmap caching";
            this.bitmapCachingCheckBox.UseVisualStyleBackColor = true;
            // 
            // visualStylesCheckBox
            // 
            this.visualStylesCheckBox.AutoSize = true;
            this.visualStylesCheckBox.Checked = true;
            this.visualStylesCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
            this.visualStylesCheckBox.Location = new System.Drawing.Point(76, 164);
            this.visualStylesCheckBox.Name = "visualStylesCheckBox";
            this.visualStylesCheckBox.Size = new System.Drawing.Size(83, 17);
            this.visualStylesCheckBox.TabIndex = 10;
            this.visualStylesCheckBox.Text = "Visual styles";
            this.visualStylesCheckBox.UseVisualStyleBackColor = true;
            // 
            // animationCheckBox
            // 
            this.animationCheckBox.AutoSize = true;
            this.animationCheckBox.Location = new System.Drawing.Point(76, 141);
            this.animationCheckBox.Name = "animationCheckBox";
            this.animationCheckBox.Size = new System.Drawing.Size(161, 17);
            this.animationCheckBox.TabIndex = 9;
            this.animationCheckBox.Text = "Menu and window animation";
            this.animationCheckBox.UseVisualStyleBackColor = true;
            // 
            // windowContentsCheckBox
            // 
            this.windowContentsCheckBox.AutoSize = true;
            this.windowContentsCheckBox.Location = new System.Drawing.Point(76, 118);
            this.windowContentsCheckBox.Name = "windowContentsCheckBox";
            this.windowContentsCheckBox.Size = new System.Drawing.Size(207, 17);
            this.windowContentsCheckBox.TabIndex = 8;
            this.windowContentsCheckBox.Text = "Show window contents while dragging";
            this.windowContentsCheckBox.UseVisualStyleBackColor = true;
            // 
            // desktopCompositionCheckBox
            // 
            this.desktopCompositionCheckBox.AutoSize = true;
            this.desktopCompositionCheckBox.Location = new System.Drawing.Point(76, 95);
            this.desktopCompositionCheckBox.Name = "desktopCompositionCheckBox";
            this.desktopCompositionCheckBox.Size = new System.Drawing.Size(125, 17);
            this.desktopCompositionCheckBox.TabIndex = 7;
            this.desktopCompositionCheckBox.Text = "Desktop composition";
            this.desktopCompositionCheckBox.UseVisualStyleBackColor = true;
            // 
            // fontSmoothingCheckBox
            // 
            this.fontSmoothingCheckBox.AutoSize = true;
            this.fontSmoothingCheckBox.Location = new System.Drawing.Point(76, 71);
            this.fontSmoothingCheckBox.Name = "fontSmoothingCheckBox";
            this.fontSmoothingCheckBox.Size = new System.Drawing.Size(98, 17);
            this.fontSmoothingCheckBox.TabIndex = 6;
            this.fontSmoothingCheckBox.Text = "Font smoothing";
            this.fontSmoothingCheckBox.UseVisualStyleBackColor = true;
            // 
            // performanceLabel
            // 
            this.performanceLabel.AutoSize = true;
            this.performanceLabel.Location = new System.Drawing.Point(73, 20);
            this.performanceLabel.Name = "performanceLabel";
            this.performanceLabel.Size = new System.Drawing.Size(97, 13);
            this.performanceLabel.TabIndex = 5;
            this.performanceLabel.Text = "Allow the following:";
            // 
            // desktopBackgroundCheckBox
            // 
            this.desktopBackgroundCheckBox.AutoSize = true;
            this.desktopBackgroundCheckBox.Location = new System.Drawing.Point(76, 47);
            this.desktopBackgroundCheckBox.Name = "desktopBackgroundCheckBox";
            this.desktopBackgroundCheckBox.Size = new System.Drawing.Size(126, 17);
            this.desktopBackgroundCheckBox.TabIndex = 4;
            this.desktopBackgroundCheckBox.Text = "Desktop background";
            this.desktopBackgroundCheckBox.UseVisualStyleBackColor = true;
            // 
            // connectButton
            // 
            this.connectButton.Location = new System.Drawing.Point(317, 432);
            this.connectButton.Name = "connectButton";
            this.connectButton.Size = new System.Drawing.Size(75, 23);
            this.connectButton.TabIndex = 6;
            this.connectButton.Text = "Connect";
            this.connectButton.UseVisualStyleBackColor = true;
            this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
            // 
            // radioButton1
            // 
            this.radioButton1.AutoSize = true;
            this.radioButton1.Location = new System.Drawing.Point(78, 65);
            this.radioButton1.Name = "radioButton1";
            this.radioButton1.Size = new System.Drawing.Size(142, 17);
            this.radioButton1.TabIndex = 2;
            this.radioButton1.Text = "Play on remote computer";
            this.radioButton1.UseVisualStyleBackColor = true;
            // 
            // radioButton2
            // 
            this.radioButton2.AutoSize = true;
            this.radioButton2.Location = new System.Drawing.Point(78, 42);
            this.radioButton2.Name = "radioButton2";
            this.radioButton2.Size = new System.Drawing.Size(79, 17);
            this.radioButton2.TabIndex = 1;
            this.radioButton2.Text = "Do not play";
            this.radioButton2.UseVisualStyleBackColor = true;
            // 
            // radioButton3
            // 
            this.radioButton3.AutoSize = true;
            this.radioButton3.Checked = true;
            this.radioButton3.Location = new System.Drawing.Point(78, 19);
            this.radioButton3.Name = "radioButton3";
            this.radioButton3.Size = new System.Drawing.Size(126, 17);
            this.radioButton3.TabIndex = 0;
            this.radioButton3.TabStop = true;
            this.radioButton3.Text = "Play on this computer";
            this.radioButton3.UseVisualStyleBackColor = true;
            // 
            // rdcImage
            // 
            this.rdcImage.BackColor = System.Drawing.Color.Transparent;
            this.rdcImage.Image = global::EasyConnect.Properties.Resources.RDC;
            this.rdcImage.Location = new System.Drawing.Point(20, 16);
            this.rdcImage.Name = "rdcImage";
            this.rdcImage.Size = new System.Drawing.Size(68, 69);
            this.rdcImage.TabIndex = 0;
            this.rdcImage.TabStop = false;
            // 
            // gradientBackground
            // 
            this.gradientBackground.Image = global::EasyConnect.Properties.Resources.Gradient;
            this.gradientBackground.Location = new System.Drawing.Point(-2, -1);
            this.gradientBackground.Name = "gradientBackground";
            this.gradientBackground.Size = new System.Drawing.Size(422, 102);
            this.gradientBackground.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.gradientBackground.TabIndex = 5;
            this.gradientBackground.TabStop = false;
            // 
            // pictureBox2
            // 
            this.pictureBox2.Image = global::EasyConnect.Properties.Resources.Folder;
            this.pictureBox2.Location = new System.Drawing.Point(17, 20);
            this.pictureBox2.Name = "pictureBox2";
            this.pictureBox2.Size = new System.Drawing.Size(52, 51);
            this.pictureBox2.TabIndex = 0;
            this.pictureBox2.TabStop = false;
            // 
            // pictureBox1
            // 
            this.pictureBox1.Image = global::EasyConnect.Properties.Resources.Computer;
            this.pictureBox1.Location = new System.Drawing.Point(17, 19);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(52, 50);
            this.pictureBox1.TabIndex = 2;
            this.pictureBox1.TabStop = false;
            // 
            // pictureBox4
            // 
            this.pictureBox4.Image = global::EasyConnect.Properties.Resources.Colors;
            this.pictureBox4.Location = new System.Drawing.Point(18, 19);
            this.pictureBox4.Name = "pictureBox4";
            this.pictureBox4.Size = new System.Drawing.Size(40, 41);
            this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBox4.TabIndex = 0;
            this.pictureBox4.TabStop = false;
            // 
            // pictureBox3
            // 
            this.pictureBox3.Image = global::EasyConnect.Properties.Resources.Monitor;
            this.pictureBox3.Location = new System.Drawing.Point(18, 23);
            this.pictureBox3.Name = "pictureBox3";
            this.pictureBox3.Size = new System.Drawing.Size(40, 41);
            this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBox3.TabIndex = 0;
            this.pictureBox3.TabStop = false;
            // 
            // pictureBox6
            // 
            this.pictureBox6.Image = global::EasyConnect.Properties.Resources.Printer;
            this.pictureBox6.Location = new System.Drawing.Point(18, 23);
            this.pictureBox6.Name = "pictureBox6";
            this.pictureBox6.Size = new System.Drawing.Size(40, 41);
            this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox6.TabIndex = 3;
            this.pictureBox6.TabStop = false;
            // 
            // pictureBox5
            // 
            this.pictureBox5.Image = global::EasyConnect.Properties.Resources.Keyboard;
            this.pictureBox5.Location = new System.Drawing.Point(18, 23);
            this.pictureBox5.Name = "pictureBox5";
            this.pictureBox5.Size = new System.Drawing.Size(40, 41);
            this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox5.TabIndex = 3;
            this.pictureBox5.TabStop = false;
            // 
            // audioPictureBox
            // 
            this.audioPictureBox.Image = global::EasyConnect.Properties.Resources.Sound;
            this.audioPictureBox.Location = new System.Drawing.Point(18, 23);
            this.audioPictureBox.Name = "audioPictureBox";
            this.audioPictureBox.Size = new System.Drawing.Size(40, 41);
            this.audioPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.audioPictureBox.TabIndex = 3;
            this.audioPictureBox.TabStop = false;
            // 
            // pictureBox8
            // 
            this.pictureBox8.Image = global::EasyConnect.Properties.Resources.Performance;
            this.pictureBox8.Location = new System.Drawing.Point(18, 23);
            this.pictureBox8.Name = "pictureBox8";
            this.pictureBox8.Size = new System.Drawing.Size(40, 41);
            this.pictureBox8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox8.TabIndex = 3;
            this.pictureBox8.TabStop = false;
            // 
            // pictureBox7
            // 
            this.pictureBox7.Image = global::EasyConnect.Properties.Resources.Sound;
            this.pictureBox7.Location = new System.Drawing.Point(18, 23);
            this.pictureBox7.Name = "pictureBox7";
            this.pictureBox7.Size = new System.Drawing.Size(40, 41);
            this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox7.TabIndex = 3;
            this.pictureBox7.TabStop = false;
            // 
            // passwordTextBox
            // 
            this.passwordTextBox.Location = new System.Drawing.Point(169, 102);
            this.passwordTextBox.Name = "passwordTextBox";
            this.passwordTextBox.PasswordChar = '*';
            this.passwordTextBox.SecureText = secureString1;
            this.passwordTextBox.Size = new System.Drawing.Size(168, 20);
            this.passwordTextBox.TabIndex = 7;
            // 
            // ConnectionWindow
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.Window;
            this.ClientSize = new System.Drawing.Size(404, 467);
            this.Controls.Add(this.connectButton);
            this.Controls.Add(this.rdcLabel2);
            this.Controls.Add(this.rdcImage);
            this.Controls.Add(this.rdcLabel1);
            this.Controls.Add(this.gradientBackground);
            this.Controls.Add(this.tabControl);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ConnectionWindow";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Remote Desktop Connection";
            this.tabControl.ResumeLayout(false);
            this.generalTabPage.ResumeLayout(false);
            this.connectionSettingsGroupBox.ResumeLayout(false);
            this.connectionSettingsGroupBox.PerformLayout();
            this.logonSettingsGroupBox.ResumeLayout(false);
            this.logonSettingsGroupBox.PerformLayout();
            this.displayTabPage.ResumeLayout(false);
            this.colorDepthGroupBox.ResumeLayout(false);
            this.colorDepthGroupBox.PerformLayout();
            this.displayConfigurationGroupBox.ResumeLayout(false);
            this.displayConfigurationGroupBox.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.resolutionTrackBar)).EndInit();
            this.localResourcesTabPage.ResumeLayout(false);
            this.localDevicesGroupBox.ResumeLayout(false);
            this.localDevicesGroupBox.PerformLayout();
            this.keyboardGroupBox.ResumeLayout(false);
            this.keyboardGroupBox.PerformLayout();
            this.remoteAudioGroupBox.ResumeLayout(false);
            this.remoteAudioGroupBox.PerformLayout();
            this.experienceTab.ResumeLayout(false);
            this.performanceGroupBox.ResumeLayout(false);
            this.performanceGroupBox.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.rdcImage)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gradientBackground)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.audioPictureBox)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
 public static string GetPlainPassword(System.Security.SecureString secPass)
 {
     throw null;
 }