⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 VC++实现的加密解密类
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Security.Cryptography;

namespace Encryption_Demo
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.TextBox FileName;
		private System.Windows.Forms.Button OpenFileBtn;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.RichTextBox richbox;
		private System.Windows.Forms.Button SendFileToDTS;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.TabPage tabPage2;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Button StartStepsBtn;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.TabPage tabPage3;
		private System.Windows.Forms.Button DepartBytes;
		private System.Windows.Forms.Button CreateXmlKeys;
		private System.Windows.Forms.GroupBox groupBox5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label9;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			InitializeComponent();
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.SendFileToDTS = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.OpenFileBtn = new System.Windows.Forms.Button();
			this.FileName = new System.Windows.Forms.TextBox();
			this.richbox = new System.Windows.Forms.RichTextBox();
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.StartStepsBtn = new System.Windows.Forms.Button();
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.label5 = new System.Windows.Forms.Label();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.label3 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
			this.tabPage3 = new System.Windows.Forms.TabPage();
			this.DepartBytes = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.CreateXmlKeys = new System.Windows.Forms.Button();
			this.groupBox5 = new System.Windows.Forms.GroupBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.tabPage2.SuspendLayout();
			this.groupBox4.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.tabPage3.SuspendLayout();
			this.groupBox5.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.SendFileToDTS);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.OpenFileBtn);
			this.groupBox1.Controls.Add(this.FileName);
			this.groupBox1.Location = new System.Drawing.Point(56, 32);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(440, 168);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "第一步:数字时间戳";
			// 
			// SendFileToDTS
			// 
			this.SendFileToDTS.Location = new System.Drawing.Point(64, 88);
			this.SendFileToDTS.Name = "SendFileToDTS";
			this.SendFileToDTS.Size = new System.Drawing.Size(256, 24);
			this.SendFileToDTS.TabIndex = 7;
			this.SendFileToDTS.Text = "提交文件到DTS服务中心...";
			this.SendFileToDTS.Click += new System.EventHandler(this.SendFileToDTS_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(40, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(312, 16);
			this.label1.TabIndex = 2;
			this.label1.Text = "请打开需要加时间戳的文件:";
			// 
			// OpenFileBtn
			// 
			this.OpenFileBtn.Location = new System.Drawing.Point(336, 48);
			this.OpenFileBtn.Name = "OpenFileBtn";
			this.OpenFileBtn.Size = new System.Drawing.Size(64, 23);
			this.OpenFileBtn.TabIndex = 1;
			this.OpenFileBtn.Text = "打开文件";
			this.OpenFileBtn.Click += new System.EventHandler(this.OpenFileBtn_Click);
			// 
			// FileName
			// 
			this.FileName.Location = new System.Drawing.Point(32, 48);
			this.FileName.Name = "FileName";
			this.FileName.Size = new System.Drawing.Size(304, 21);
			this.FileName.TabIndex = 0;
			this.FileName.Text = "textBox1";
			// 
			// richbox
			// 
			this.richbox.Location = new System.Drawing.Point(80, 328);
			this.richbox.Name = "richbox";
			this.richbox.Size = new System.Drawing.Size(416, 80);
			this.richbox.TabIndex = 6;
			this.richbox.Text = "你没有进行什么操作!";
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Controls.Add(this.tabPage3);
			this.tabControl1.Location = new System.Drawing.Point(8, 16);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(616, 288);
			this.tabControl1.TabIndex = 7;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.groupBox1);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(608, 263);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "加密步骤一";
			// 
			// tabPage2
			// 
			this.tabPage2.Controls.Add(this.groupBox5);
			this.tabPage2.Controls.Add(this.StartStepsBtn);
			this.tabPage2.Controls.Add(this.groupBox4);
			this.tabPage2.Controls.Add(this.groupBox3);
			this.tabPage2.Controls.Add(this.groupBox2);
			this.tabPage2.Location = new System.Drawing.Point(4, 21);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Size = new System.Drawing.Size(608, 263);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "加密步骤二";
			// 
			// StartStepsBtn
			// 
			this.StartStepsBtn.Location = new System.Drawing.Point(240, 224);
			this.StartStepsBtn.Name = "StartStepsBtn";
			this.StartStepsBtn.Size = new System.Drawing.Size(104, 23);
			this.StartStepsBtn.TabIndex = 3;
			this.StartStepsBtn.Text = "开始以上步骤";
			this.StartStepsBtn.Click += new System.EventHandler(this.StartStepsBtn_Click);
			// 
			// groupBox4
			// 
			this.groupBox4.Controls.Add(this.label2);
			this.groupBox4.Location = new System.Drawing.Point(320, 120);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(216, 80);
			this.groupBox4.TabIndex = 2;
			this.groupBox4.TabStop = false;
			this.groupBox4.Text = "线程三";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(8, 24);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(192, 48);
			this.label5.TabIndex = 0;
			this.label5.Text = "使用发送者私钥签名随机密钥,使用接收者公钥加密密钥和签名";
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.label3);
			this.groupBox3.Location = new System.Drawing.Point(72, 32);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(208, 64);
			this.groupBox3.TabIndex = 1;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "第一步:";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 32);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(184, 24);
			this.label3.TabIndex = 0;
			this.label3.Text = "随机产生对成加密钥匙Key和IV";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Location = new System.Drawing.Point(320, 24);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(216, 80);
			this.groupBox2.TabIndex = 0;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "第二步:";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(32, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(160, 40);
			this.label2.TabIndex = 0;
			this.label2.Text = "MD5摘要生成-->用发送者私钥签名";
			// 
			// tabPage3
			// 
			this.tabPage3.Controls.Add(this.label9);
			this.tabPage3.Controls.Add(this.label7);
			this.tabPage3.Controls.Add(this.label8);
			this.tabPage3.Controls.Add(this.label4);
			this.tabPage3.Controls.Add(this.DepartBytes);
			this.tabPage3.Location = new System.Drawing.Point(4, 21);
			this.tabPage3.Name = "tabPage3";
			this.tabPage3.Size = new System.Drawing.Size(608, 263);
			this.tabPage3.TabIndex = 2;
			this.tabPage3.Text = "解密步骤";
			// 
			// DepartBytes
			// 
			this.DepartBytes.Location = new System.Drawing.Point(256, 232);
			this.DepartBytes.Name = "DepartBytes";
			this.DepartBytes.Size = new System.Drawing.Size(72, 24);
			this.DepartBytes.TabIndex = 0;
			this.DepartBytes.Text = "开始解密";
			this.DepartBytes.Click += new System.EventHandler(this.DepartBytes_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(528, 320);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(88, 32);
			this.button1.TabIndex = 8;
			this.button1.Text = "产生私钥";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(536, 352);
			this.button2.Name = "button2";
			this.button2.TabIndex = 9;
			this.button2.Text = "产生实例";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// CreateXmlKeys
			// 
			this.CreateXmlKeys.Location = new System.Drawing.Point(528, 392);
			this.CreateXmlKeys.Name = "CreateXmlKeys";
			this.CreateXmlKeys.Size = new System.Drawing.Size(104, 24);
			this.CreateXmlKeys.TabIndex = 10;
			this.CreateXmlKeys.Text = "产生一对钥匙";
			this.CreateXmlKeys.Click += new System.EventHandler(this.CreateXmlKeys_Click);
			// 
			// groupBox5
			// 
			this.groupBox5.Controls.Add(this.label6);
			this.groupBox5.Location = new System.Drawing.Point(88, 120);
			this.groupBox5.Name = "groupBox5";
			this.groupBox5.Size = new System.Drawing.Size(192, 72);
			this.groupBox5.TabIndex = 4;
			this.groupBox5.TabStop = false;
			this.groupBox5.Text = "第三步:";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(16, 24);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(160, 32);
			this.label6.TabIndex = 0;
			this.label6.Text = "利用随机密钥使用DES算法分组加密数据";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(64, 32);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(496, 24);
			this.label4.TabIndex = 1;
			this.label4.Text = "分解出加密后的会话密钥密文=》发送者私钥解密=》接受者公钥验证=》分解出密钥";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(72, 80);
			this.label8.Name = "label8";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -