導航:首頁 > 文檔加密 > 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加密相關的資料

熱點內容
為什麼zar找不到解壓文件 瀏覽:119
mud手機app源碼 瀏覽:180
app怎麼查看自己的主域名 瀏覽:639
歐洲銀行加密幣市場 瀏覽:859
linuxc編程高級 瀏覽:733
python解碼vip視頻 瀏覽:594
醜陋的中國人pdf 瀏覽:717
我的世界如何在伺服器裡面裝模組 瀏覽:624
javaweb進銷存源碼下載 瀏覽:557
單片機遙控門鈴設計圖解 瀏覽:324
閃送app怎麼更改照片 瀏覽:160
公司的程序員開始忙了 瀏覽:507
統信系統命令行如何輸漢字 瀏覽:281
java隨機取數組 瀏覽:478
伺服器匆忙什麼意思 瀏覽:780
windows下載文件命令 瀏覽:101
紹興加密防偽技術 瀏覽:54
linux清除緩存的命令 瀏覽:779
樑柱連接處梁的加密箍筋 瀏覽:103
安卓錄屏大師如何彈出 瀏覽:658