Exemplo n.º 1
0
        private void frmCipherBoy_Load(object sender, EventArgs e)
        {
            //check and install SSISCipherUtil.dll to GAC
            AssemblyAdministration.RunOnce();

            btnDPAPIEncrypt.Enabled                 = false;
            btnDPAPIDecrypt.Enabled                 = false;
            btnDPAPICommitChanges.Enabled           = false;
            btnDPAPIGenerateDecryptorSource.Enabled = false;
            btnDPAPILockUnlock.Enabled              = false;

            btnRSAEncrypt.Enabled                 = false;
            btnRSADecrypt.Enabled                 = false;
            btnRSACommitChanges.Enabled           = false;
            btnRSAGenerateDecryptorSource.Enabled = false;
            btnRSALockUnlock.Enabled              = false;

            btnLoadXmlConfigFile.Enabled   = false;
            btnUnloadXmlConfigFile.Enabled = false;
            btnUnloadXmlConfigFile.Visible = false;


            txtXmlConfigFilePath.ForeColor = Color.Gray;
            txtKeyContainerName.ForeColor  = Color.Gray;
        }
 private void btnUninstallDllFromGAC_Click(object sender, EventArgs e)
 {
     try
     {
         AssemblyAdministration.WriteAssemblyAndUninstall();
     }
     catch (Exception eX)
     {
         MessageBox.Show(text: eX.Message, caption: "Something went wrong!", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
     }
 }
 private void btnEmitDllToWorkingDir_Click(object sender, EventArgs e)
 {
     try
     {
         AssemblyAdministration.WriteAssemblyToFile(AssemblyAdministration.targetAssemblyName);
         MessageBox.Show(text: "Assembly write success - " + AssemblyAdministration.targetAssemblyName, caption: "Success", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Information);
     }
     catch (Exception eX)
     {
         MessageBox.Show(text: eX.Message, caption: "Something went wrong!", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
     }
 }
        private void btnEmitDllToSpecificLocation_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog sfdSaveDecryptorCode = new SaveFileDialog();
                sfdSaveDecryptorCode.Filter   = "Assembly|*.dll";
                sfdSaveDecryptorCode.FileName = AssemblyAdministration.targetAssemblyName;
                DialogResult dr = sfdSaveDecryptorCode.ShowDialog();

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    AssemblyAdministration.WriteAssemblyToFile(sfdSaveDecryptorCode.FileName);
                    MessageBox.Show(text: "Assembly write success - " + sfdSaveDecryptorCode.FileName, caption: "Success", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Information);
                }
            }

            catch (Exception eX)
            {
                MessageBox.Show(text: eX.Message, caption: "Something went wrong!", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error);
            }
        }