Example #1
0
        public override void RunCommand(object sender)
        {
            var engine = (AutomationEngineInstance)sender;

            //get variablized input
            var variableInput = v_InputValue.ConvertUserVariableToString(engine);
            var passphrase    = v_PassPhrase.ConvertUserVariableToString(engine);

            string resultData = "";

            if (v_EncryptionType.ConvertUserVariableToString(engine) == "Encrypt")
            {
                //encrypt data
                resultData = EncryptionServices.EncryptString(variableInput, passphrase);
            }
            else if (v_EncryptionType.ConvertUserVariableToString(engine) == "Decrypt")
            {
                //encrypt data
                resultData = EncryptionServices.DecryptString(variableInput, passphrase);
            }
            else
            {
                throw new NotImplementedException($"Encryption Service Requested '{v_EncryptionType.ConvertUserVariableToString(engine)}' has not been implemented");
            }

            resultData.StoreInUserVariable(engine, v_OutputUserVariableName);
        }
        private void HelperControl_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(InputText.Text))
            {
                return;
            }

            var encrypted = EncryptionServices.EncryptString(InputText.Text, "TASKT");

            v_EncryptionOption = "Encrypted";

            InputText.Text = encrypted;
        }
        private void EncryptPassword(CommandItemControl sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ConnectionStringPassword.Text))
            {
                return;
            }

            var acknowledgement = MessageBox.Show("WARNING! This function will encrypt the password locally but is not extremely secure as the client knows the secret!  Consider using a password management service instead. The encrypted password will be stored with a leading exclamation ('!') whch the automation engine will detect and know to decrypt the value automatically at run-time. Do not encrypt the password multiple times or the decryption will be invalid!  Would you like to proceed?", "Encryption Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (acknowledgement == DialogResult.Yes)
            {
                ConnectionStringPassword.Text = string.Concat($"!{EncryptionServices.EncryptString(ConnectionStringPassword.Text, "taskt-database-automation")}");
            }
        }
Example #4
0
        private void EncryptText(object sender, EventArgs e, IfrmCommandEditor editor)
        {
            CommandItemControl inputBox      = (CommandItemControl)sender;
            TextBox            targetTextbox = (TextBox)inputBox.Tag;

            if (string.IsNullOrEmpty(targetTextbox.Text))
            {
                return;
            }

            var encrypted = EncryptionServices.EncryptString(targetTextbox.Text, "OPENBOTS");

            targetTextbox.Text = encrypted;

            ComboBox comboBoxControl = (ComboBox)((frmCommandEditor)editor).flw_InputVariables.Controls["v_EncryptionOption"];

            comboBoxControl.Text = "Encrypted";
        }
Example #5
0
        public override void RunCommand(object sender)
        {
            var engine = (IAutomationEngineInstance)sender;

            var variableInput = v_InputValue.ConvertUserVariableToString(engine);
            var passphrase    = v_PassPhrase.ConvertUserVariableToString(engine);

            string resultData = "";

            if (v_EncryptionType == "Encrypt")
            {
                resultData = EncryptionServices.EncryptString(variableInput, passphrase);
            }
            else if (v_EncryptionType == "Decrypt")
            {
                resultData = EncryptionServices.DecryptString(variableInput, passphrase);
            }

            resultData.StoreInUserVariable(engine, v_OutputUserVariableName, nameof(v_OutputUserVariableName), this);
        }
        public async override Tasks.Task RunCommand(object sender)
        {
            var engine = (IAutomationEngineInstance)sender;

            var variableInput = (string)await v_InputValue.EvaluateCode(engine);

            var passphrase = (string)await v_PassPhrase.EvaluateCode(engine);

            string resultData = "";

            if (v_EncryptionType == "Encrypt")
            {
                resultData = EncryptionServices.EncryptString(variableInput, passphrase);
            }
            else if (v_EncryptionType == "Decrypt")
            {
                resultData = EncryptionServices.DecryptString(variableInput, passphrase);
            }

            resultData.SetVariableValue(engine, v_OutputUserVariableName);
        }
        private void ElementsGridViewHelper_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var targetCell = ElementsGridViewHelper.Rows[e.RowIndex].Cells[e.ColumnIndex];

            if (targetCell is DataGridViewButtonCell && targetCell.Value.ToString() == "Encrypt Text")
            {
                var targetElement = ElementsGridViewHelper.Rows[0].Cells[1];

                if (string.IsNullOrEmpty(targetElement.Value.ToString()))
                {
                    return;
                }

                var warning = MessageBox.Show($"Warning! Text should only be encrypted one time and is not reversible in the builder.  Would you like to proceed and convert '{targetElement.Value.ToString()}' to an encrypted value?", "Encryption Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (warning == DialogResult.Yes)
                {
                    targetElement.Value = EncryptionServices.EncryptString(targetElement.Value.ToString(), "TASKT");
                    ElementsGridViewHelper.Rows[2].Cells[1].Value = "Encrypted";
                }
            }
        }