导航:首页 > 文档加密 > net加密

net加密

发布时间:2022-01-23 17:26:52

Ⅰ asp.net如何进行用户名和密码的加密和解密

这个方法不安全,如果给人侦听到加密后的密码,就可以用加密后的密码伪装成用户登陆了。

Ⅱ asp.net中有几种加密方式分别怎样写

MD5:
string str="abc";
string jiami = FormsAuthentication.(str,"MD5")
Response.Write(jiami);
这样加密后的abc就不再是abc了
就是输出的jiami这个字符串就如上所说的32B32A2C....
----------------------------------------------------------------------
把上面的那段代码在VS2005中运行一下 去看看结果就知道了 朋友
----------------------------------------------------------------------
希望对你有帮助

Ⅲ .NET 加密算法

rgbKey是加密时候用的key,rgbIV 是加密时候用的Initial Vector。
TransformFinalBlock是解密DeString的0到最后。
最后是按UTF8的encoding来return字符串。

Ⅳ 如何给.Net软件加密

可以使用加密狗进行加密,把软件的一部分信息写入加密狗里进行绑定,使加密狗成为软件的一部分,没有加密狗无法运行。也可以使用外壳加密,不需要二次开发。可以试试ROCKEY系列的加密狗。

Ⅳ .NET如何实现数据加密

http://www.microsoft.com/china/technet/security/guidance/secmod39.mspx(最好的理论资料)
建立一个win form程序,然后把代码拷到后台,即可实现C#非对称加密程序 。
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text;
using System.Security.Cryptography;

namespace 非对称加密
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.SaveFileDialog save;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RichTextBox richtext2;
private System.Windows.Forms.OpenFileDialog open;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.RichTextBox richtext3;
private System.Windows.Forms.RichTextBox richtext;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
/// <summary>
/// 必需的设计器变量。
private static RSACryptoServiceProvider crypt;
private static string privatekey;
private static string publickey;
private static byte [] bytes;
private static string publicinfo;
private static string privateinfo;
private static string readpublickey;
private static string readprivatekey;
// ///private static byte [] onebytes ;

/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 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.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.button6 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.richtext = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button8 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.richtext3 = new System.Windows.Forms.RichTextBox();
this.label2 = new System.Windows.Forms.Label();
this.richtext2 = new System.Windows.Forms.RichTextBox();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.save = new System.Windows.Forms.SaveFileDialog();
this.open = new System.Windows.Forms.OpenFileDialog();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(32, 64);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(416, 280);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.button6);
this.tabPage1.Controls.Add(this.button3);
this.tabPage1.Controls.Add(this.button2);
this.tabPage1.Controls.Add(this.richtext);
this.tabPage1.Controls.Add(this.button1);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(408, 255);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "得到钥匙";
//
// button6
//
this.button6.Location = new System.Drawing.Point(72, 168);
this.button6.Name = "button6";
this.button6.TabIndex = 4;
this.button6.Text = "写入文件";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(200, 16);
this.button3.Name = "button3";
this.button3.TabIndex = 3;
this.button3.Text = "保存私匙";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(128, 16);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "保存公钥";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// richtext
//
this.richtext.Location = new System.Drawing.Point(16, 56);
this.richtext.Name = "richtext";
this.richtext.Size = new System.Drawing.Size(256, 96);
this.richtext.TabIndex = 1;
this.richtext.Text = "richTextBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 23);
this.button1.TabIndex = 0;
this.button1.Text = "得到钥匙信息";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.button8);
this.tabPage2.Controls.Add(this.button7);
this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Controls.Add(this.richtext3);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.richtext2);
this.tabPage2.Controls.Add(this.button5);
this.tabPage2.Controls.Add(this.button4);
this.tabPage2.Controls.Add(this.textBox1);
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.Location = new System.Drawing.Point(4, 21);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(408, 255);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "加密解密文字";
//
// button8
//
this.button8.Location = new System.Drawing.Point(216, 72);
this.button8.Name = "button8";
this.button8.TabIndex = 9;
this.button8.Text = "读取私匙";
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(56, 72);
this.button7.Name = "button7";
this.button7.TabIndex = 8;
this.button7.Text = "读取公匙";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(200, 120);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 16);
this.label3.TabIndex = 7;
this.label3.Text = "解密结果";
//
// richtext3
//
this.richtext3.Location = new System.Drawing.Point(200, 144);
this.richtext3.Name = "richtext3";
this.richtext3.Size = new System.Drawing.Size(120, 72);
this.richtext3.TabIndex = 6;
this.richtext3.Text = "richTextBox2";
//
// label2
//
this.label2.Location = new System.Drawing.Point(48, 120);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(128, 16);
this.label2.TabIndex = 5;
this.label2.Text = "加密窗口:";
//
// richtext2
//
this.richtext2.Location = new System.Drawing.Point(40, 144);
this.richtext2.Name = "richtext2";
this.richtext2.Size = new System.Drawing.Size(120, 72);
this.richtext2.TabIndex = 4;
this.richtext2.Text = "richTextBox2";
//
// button5
//
this.button5.Location = new System.Drawing.Point(200, 96);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(112, 23);
this.button5.TabIndex = 3;
this.button5.Text = "使用私匙解密";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(48, 96);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(96, 23);
this.button4.TabIndex = 2;
this.button4.Text = "使用公匙加密";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(104, 32);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(168, 32);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// label1
//
this.label1.Location = new System.Drawing.Point(128, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(120, 16);
this.label1.TabIndex = 0;
this.label1.Text = "请输入加密的文字";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(504, 357);
this.Controls.Add(this.tabControl1);
this.Name = "Form1";
this.Text = "Form1";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
//得到钥匙信息
private void button1_Click(object sender, System.EventArgs e)
{
crypt=new RSACryptoServiceProvider();
publickey=crypt.ToXmlString(false);
richtext.Text="导出秘匙的情况下:\n"+publickey+"\n";
privatekey=crypt.ToXmlString(true);
string info="仅仅导出公匙的情况下:\n"+privatekey+"\n";
richtext.AppendText(info);
crypt.Clear();

}
//保存公匙信息
private void button2_Click(object sender, System.EventArgs e)
{

save=new SaveFileDialog();
save.Filter="File Text (*.txt)|*.txt|All File (*.*)|*.*";
save.ShowDialog();
publicinfo=save.FileName;

}
//保存密匙信息
private void button3_Click(object sender, System.EventArgs e)
{
save=new SaveFileDialog();
save.Filter="File Text (*.txt)|*.txt|All File (*.*)|*.*";
save.ShowDialog();
privateinfo=save.FileName;

}
//把钥匙信息写入文件
private void button6_Click(object sender, System.EventArgs e)
{

StreamWriter one=new StreamWriter(publicinfo,true,UTF8Encoding.UTF8);
one.Write(publickey);
StreamWriter two=new StreamWriter(privateinfo,true,UTF8Encoding.UTF8);
two.Write(privatekey);
one.Flush();
two.Flush();
one.Close();
two.Close();
MessageBox.Show("成功保存公匙和密匙!");

}
//用公匙加密
private void button4_Click(object sender, System.EventArgs e)
{

crypt=new RSACryptoServiceProvider();
UTF8Encoding enc=new UTF8Encoding();
bytes=enc.GetBytes(textBox1.Text);
crypt.FromXmlString( readpublickey );
bytes = crypt.Encrypt( bytes,false );
string encryttext=enc.GetString(bytes);//encryptbyte);
richtext2.Text="加密结果:\n"+encryttext+"\n"+"加密结束!";
}

private void button5_Click(object sender, System.EventArgs e)
{

UTF8Encoding enc=new UTF8Encoding();
byte [] decryptbyte;
crypt.FromXmlString ( readprivatekey ) ;
decryptbyte = crypt.Decrypt( bytes,false );
string decrypttext=enc.GetString( decryptbyte );
richtext3.Text = "解密结果:\n" + decrypttext + "\n" + "解密结束!" ;

}
//从文件中读取公匙信息
private void button7_Click(object sender, System.EventArgs e)
{
StreamReader sr ;
open = new OpenFileDialog( );
open.Filter="Text File (*.txt)|*.txt|All File (*.*)|*.* ";
// open.ShowDialog();
if(open.ShowDialog()==DialogResult.OK)
{
sr = new StreamReader(open.FileName,UTF8Encoding.UTF8);
}
else
{
MessageBox.Show("发生错误!");
return;
}
readpublickey = sr.ReadToEnd();
sr.Close();
}
//从文件中读取私匙信息
private void button8_Click(object sender, System.EventArgs e)
{
open = new OpenFileDialog( );
open.Filter="Text File (*.txt)|*.txt|All File (*.*)|*.* ";
open.ShowDialog();
StreamReader sr = new StreamReader(open.FileName,UTF8Encoding.UTF8);
readprivatekey = sr.ReadToEnd();
sr.Close();
}

}
}

Ⅵ .net中,md5具体怎么使用加密和解密

md5加密了你还想解密啊? md5是不可逆的。要么你就自己写套加密算法别用md5。这样就可以加密解密了。

Ⅶ .net软件,加密,哪种加密锁比较好,混淆代码能力如何

《web虎-加密防盗版系统》
团队核心成员平均超10年相关经验,web虎超3年研发测试。近600家软件/课件客户,国家汉办等用户多年实用检验。使用不同于同类产品的驱动层加密使加密锁安全性,通用性更好。
联系我们可以根据您的需求进行免费的试用!

java和.NET使用DES对称加密的区别

如果我说没有区别你会信吗?
但答案还真是这样,两者没有任何区别的,只不过实现的语言代码不同而已。
那么java与dot net之间的DES是否可以通用?答案也是完全通用。无论是Java的DES加密还是dot net的DES回密,均可以使用另一种语言且不限于Java或dot net解密。够明白吗?
DES其实只是一个算法,加密与解密我们都知道算法与密码是分离的。算法是公开的,都可以用,而密码是独立于算法的。所以DES在不同的语言中实现的算法根本就是一样的——也正是因为如此不管何种语言都是通用的(除非伪DES,要知道DES算法网上本身能搜到而且是一个标准,最先是由美国安全部门公开的)
再说一下,为什么有人“通”用不起来的原因。DES其实有CBC之类的参数的,也就是针对加密块选用的不同的加密手段。正是这个参数的原因,不同的语言中使用不同的参数做为默认值,所以使用默认的方式进行让两个串进行加解密肯定是不同的。DES使用一种模式(方法)加密,用另一种模式(方法)进行解密能得到正确的结果吗?一些人不怪自己的学艺不精,反说是两种语言的DES不通用(这也就是为什么网络上会出现诸多说java和dot net的DES加密方法不通用的原因)。
即便是自己使用的DES加密的代码也是通用的(前提你要遵守DES分开算法),但不要“重复实现已经实现的东西(专业术语叫造轮子)”。
附:
DES.Model属性取值
CBC 密码块链 (CBC) 模式引入了反馈。每个纯文本块在加密前,通过按位“异或”操作与前一个块的密码文本结合。这样确保了即使纯文本包含许多相同的块,这些块中的每一个也会加密为不同的密码文本块。在加密块之前,初始化向量通过按位“异或”操作与第一个纯文本块结合。如果密码文本块中有一个位出错,相应的纯文本块也将出错。此外,后面的块中与原出错位的位置相同的位也将出错。
ECB 电子密码本 (ECB) 模式分别加密每个块。这意味着任何纯文本块只要相同并且在同一消息中,或者在用相同的密钥加密的不同消息中,都将被转换成同样的密码文本块。如果要加密的纯文本包含大量重复的块,则逐块破解密码文本是可行的。另外,随时准备攻击的对手可能在您没有察觉的情况下替代和交换个别的块。如果密码文本块中有一个位出错,相应的整个纯文本块也将出错。
OFB 输出反馈 (OFB) 模式将少量递增的纯文本处理成密码文本,而不是一次处理整个块。此模式与 CFB 相似;这两种模式的唯一差别是移位寄存器的填充方式不同。如果密码文本中有一个位出错,纯文本中相应的位也将出错。但是,如果密码文本中有多余或者缺少的位,则那个位之后的纯文本都将出错。
CFB 密码反馈 (CFB) 模式将少量递增的纯文本处理成密码文本,而不是一次处理整个块。该模式使用在长度上为一个块且被分为几部分的移位寄存器。例如,如果块大小为 8 个字节,并且每次处理一个字节,则移位寄存器被分为 8 个部分。如果密码文本中有一个位出错,则一个纯文本位出错,并且移位寄存器损坏。这将导致接下来若干次递增的纯文本出错,直到出错位从移位寄存器中移出为止。
CTS 密码文本窃用 (CTS) 模式处理任何长度的纯文本并产生长度与纯文本长度匹配的密码文本。除了最后两个纯文本块外,对于所有其他块,此模式与 CBC 模式的行为相同。

DES.Padding属性的取值
None 不填充。
PKCS7 PKCS #7 填充字符串由一个字节序列组成,每个字节填充该字节序列的长度。
Zeros 填充字符串由设置为零的字节组成。
ANSIX923 ANSIX923 填充字符串由一个字节序列组成,此字节序列的最后一个字节填充字节序列的长度,其余字节均填充数字零。
ISO10126 ISO10126 填充字符串由一个字节序列组成,此字节序列的最后一个字节填充字节序列的长度,其余字节填充随机数据。

当Mode不同时,解密的内密内容能与相同吗?PaddingMode不同时,解密的内容的结尾部分能相同吗(填充结果只涉及到最后的一个块).所以当不管何种语言使用相同的Mode及PaddingMode时,加解密的结果是相同的(当然不排除部分语言不实现全部的Mode和PaddingMode)但,基本的都是实现了的,所以基本上任何两种语言之间的DES都可以实现相同的加解密结果!而java和dot net中的DES显然指的是算法,两者是相同的,可以随意使用(Java中dot net中的Mode默认值是不同的,一定要设置相同的Mode和PaddingMode才可以的,不要双方都采用默认值,那样真的通不起来)

Ⅸ asp.net如何进行用户名和密码的加密和解密

代码如下:

using System.Web.Security;

string str= FormsAuthentication.(TextBox1.text, MD5")

.NET是微软下一代的操作平台,它允许人们在其上构建各种应用方式,使人们尽可能通过简单的方式,多样化地、最大限度地从网站获取信息,解决网站之间的协同工作,并打破计算机、设备、网站、各大机构和工业界间的障碍--即所谓的"数字孤岛",从而实现因特网的全部潜能,搭建起第三代互联网平台。后缀为net是网络服务公司,为个人或商业提供服务。

Ⅹ .net软件加密,加密锁哪种比较好,混淆代码可以实现吗

亲 你说的是 广联达的 加密锁吗 如果是 广联达的 建议买一个 万能的 通用全国 含有全国定额库 包升级 比较 方便划算 98一个 我们网店就有 也有广联达 入门到精通正版学习教材 学习效果很好 97一套 有兴趣 Q聊 名字就是Q号码

阅读全文

与net加密相关的资料

热点内容
pythonhive导入数据 浏览:673
安卓手机屏幕按住一直抖怎么办 浏览:194
压缩率公式 浏览:321
蓝虎app怎么下载 浏览:614
周易江湖pdf 浏览:859
java取主机名 浏览:366
python转为unicode 浏览:295
米家app门锁怎么解绑 浏览:328
田英章楷书pdf 浏览:207
为什么zar找不到解压文件 浏览:121
mud手机app源码 浏览:180
app怎么查看自己的主域名 浏览:641
欧洲银行加密币市场 浏览:861
linuxc编程高级 浏览:734
python解码vip视频 浏览:596
丑陋的中国人pdf 浏览:719
我的世界如何在服务器里面装模组 浏览:624
javaweb进销存源码下载 浏览:557
单片机遥控门铃设计图解 浏览:324
闪送app怎么更改照片 浏览:160