net代碼加密
㈠ .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程序加密C#開發軟體的源代碼怎麼加密
一般的加密,通過反編譯和跟蹤程序運行都不難破解,所以不僅要加密,還要阻止編譯,防範跟蹤。這是很專業的,市場上有很多現成加密狗產品,可以方便地解決這個問題。源代碼只能採取保密措施,加密是不行的。
㈢ 在ASP.Net中,如何使用混淆加密的方法保護自己的源代碼
其實,保護代碼不需要那麼費心。
像.net其實就是把cs文件轉換成dll
文件就可以了,轉換的方法看幫助或者去網站上搜索一下就能得到你想要的結果。
現在我們很多寫的東西,到現在好沒有到保密的程度,現在寫的東西都是很一般的...除非你寫的東西,是考慮到安全的因素很多那麼就需要多加考慮一下了...
㈣ .net軟體加密,加密鎖哪種比較好,混淆代碼可以實現嗎
加密鎖:威步(WIBU)的CodeMeter,AxProtector(for.net)兩款軟體加密鎖性能非常不錯 混淆的問題,與傳統的代碼混淆工具(Obfuscator)不同,AxProtector可以完全阻止對.NET 程序集(由 C#, VB.NET, Delphi.NET, ASP.Net… 等語言編寫)的反編譯。通俗的講,AxProtector在破解者和您的 .NET 代碼之間構建了強大的防破解保護屏障,生成一個基於 Windows 的而不是基於 MSIL 的兼容格式文件。原始的 .NET 代碼完整的被加密後封裝在本地代碼內,無論何時都不會釋放到硬碟,對於破解者是不可見的。 與單純的.net加密軟體不同,AxProtector與CodeMeter硬體加密狗配套餐使用,採用了更為嚴密的密鑰管理,及最先進的AES、RSA、ECC等加密演算法存儲或傳輸密鑰,保證通訊安全。 .Net代碼編譯後生成的 .class 中包含有源代碼中的所有信息(不包括注釋),尤其是在其中保存有調試信息的時候。所以一個按照正常方式編譯的.class 文件可以非常輕易地被反編譯。一般軟體開發商會採用一種叫做混淆器的工具。混淆器的作用是對編譯好的代碼進行混淆,使得其無法被反編譯或者反編譯後的代碼混亂難懂。由於混淆器只是混淆了方法名稱或流程,而不能防止源代碼被反編譯,因此混淆器的作用只是增加了反編譯的難度,最終的結果也是治標不治本。對於一些掌握工具的人來說幾乎還是透明的。AxProtector是一款真正意義的加密源代碼、防止反編譯的.net軟體加密軟體。 AxProtector加密了.net原代碼,任何時候原代碼都不可能被還原到硬碟當中。採用AxProtector加密後的.net代碼只有在程序調用或執行某一段函數的時候,才能通過AxProtectorClass在內存中解密後返回到程序中執行,運行之後迅速立即加密。這種隨機加密、按需解密原代碼的功能,能很好的防止.Net程序的反編譯,同時能夠很好地防止API加密點被摘除。有效地保證了源代碼的執行效率和安全性。
㈤ .net軟體,加密,哪種加密鎖比較好,混淆代碼能力如何
《web虎-加密防盜版系統》
 團隊核心成員平均超10年相關經驗,web虎超3年研發測試。近600家軟體/課件客戶,國家漢辦等用戶多年實用檢驗。使用不同於同類產品的驅動層加密使加密鎖安全性,通用性更好。
    聯系我們可以根據您的需求進行免費的試用!
㈥ asp.net(VB)加密解密源代碼
答案如下  (經本人測試,肯定是可以用的……)
  '-----------------------------------------
    '  隨機選8個位元組既為密鑰也為初始向量
    Private Shared KEY_64() As Byte = {42, 162, 39, 156, 78, 4, 218, 32}
    Private Shared IV_64() As Byte = {55, 113, 346, 79, 36, 99, 167, 3}
   
    '------------------------------------------------
    '標準的DES加密
    Public Function Encrypt(ByVal value As String) As String
        If value <> "" Then
            Dim cryptoProvider As DESCryptoServiceProvider = New DESCryptoServiceProvider
            Dim ms As MemoryStream = New MemoryStream
            Dim cs As CryptoStream = New CryptoStream(ms, cryptoProvider.CreateEncryptor(KEY_64, IV_64), CryptoStreamMode.Write)
            Dim sw As StreamWriter = New StreamWriter(cs)
            sw.Write(value)
            sw.Flush()
            cs.FlushFinalBlock()
            ms.Flush()
            '--------------------------------------
            '再轉換為一個字元串
            Return Convert.ToBase64String(ms.GetBuffer(), 0, ms.Length)
        Else
            Return ""
        End If
    End Function
    '----------------------------------
    '標準的DES解密
    Public Function Decrypt(ByVal value As String) As String
        If value <> "" Then
            Dim cryptoProvider As DESCryptoServiceProvider = New DESCryptoServiceProvider
            '---------------------------------------
            '從字元串轉換為位元組組
            Dim buffer As Byte() = Convert.FromBase64String(value)
            Dim ms As MemoryStream = New MemoryStream(buffer)
            Dim cs As CryptoStream = New CryptoStream(ms, cryptoProvider.CreateDecryptor(KEY_64, IV_64), CryptoStreamMode.Read)
            Dim sr As StreamReader = New StreamReader(cs)
            Return sr.ReadToEnd()
        Else
            Return ""
        End If
    End Function
㈦ 怎麼給asp.net的代碼加密呀,也就是說怎麼保護.aspx的源程序.
asp.net不需要加密,
它的程序會自動編譯成DLL。
aspx頁面只是頁面部分,真正的程序在.VB OR .cs文件中。
編譯後就不需要這些文件啊。
㈧ .net軟體,用什麼軟體加密狗加密,能防止代碼反編譯
.Net軟體
特點,
些強
編譯工具
.Net
執行文件進行反編譯操作,並
相應
IL代碼甚至
源代碼
即使
採用混淆工具
及強命名工具
能
根本
解決問題,代碼依
容易
Reflectoer等工具反編譯源代碼
軟體加密狗:威步(WIBU)
CodeMeter,AxProtector(for.net)兩款軟體加密狗性能非
錯
反編譯
問題,與傳統
代碼混淆工具(Obfuscator)
同,AxProtector
完全阻止
.NET
程序集(由
C#,
VB.NET,
Delphi.NET,
ASP.Net…
等語言編寫)
反編譯
通俗
講,AxProtector
破解者
您
.NET
代碼
間構建
強
防破解保護屏障,
基於
Windows
基於
MSIL
兼容格式文件
原始
.NET
代碼完整
加密
封裝
本
代碼內,
論何
都
釋放
硬碟,
於破解者
見
與單純
.net加密軟體
同,AxProtector與CodeMeter硬體加密狗配套餐使用,採用
更
嚴密
密鑰管理,及
先進
AES、RSA、ECC等加密算
存儲或傳輸密鑰,保證通訊安全
.Net代碼編譯
.class
包含
源代碼
所
信息(
包括注釋),尤其
其
保存
調試信息
候
所
按照
式編譯
.class
文件
非
輕易
反編譯
般軟體
發商
採用
種叫做混淆器
工具
混淆器
作用
編譯
代碼進行混淆,使
其
反編譯或者反編譯
代碼混亂難懂
由於混淆器
混淆
名稱或流程,
能防止源代碼
反編譯,
混淆器
作用
增加
反編譯
難度,
終
結
治標
治本
於
些掌握工具
說幾乎
透明
AxProtector
款真
意義
加密源代碼、防止反編譯
.net軟體加密軟體
AxProtector加密
.net原代碼,任何
候原代碼都
能
原
硬碟
採用AxProtector加密
.net代碼
程序調用或執行某
段函數
候,才能通
AxProtectorClass
內存
解密
返
程序
執行,運行
迅速立即加密
種隨機加密、按需解密原代碼
功能,能
防止.Net程序
反編譯,同
能夠
防止API加密點
摘除
效
保證
源代碼
執行效率
安全性
㈨ asp.net 地址加密,具體的代碼
自定義方法來實現URL的加密與解密,代碼如下:
using System.Security.Cryptography;
using System.IO;
using System.text;
/// <summary>
        /// 加密
        /// </summary>
        /// <param name="str"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string Encode(string str, string key)
         {
             DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
             provider.Key = Encoding.ASCII.GetBytes(key.Substring(0, 8));
             provider.IV = Encoding.ASCII.GetBytes(key.Substring(0, 8));
            byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(str);
             MemoryStream stream = new MemoryStream();
             CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write);
             stream2.Write(bytes, 0, bytes.Length);
             stream2.FlushFinalBlock();
             StringBuilder builder = new StringBuilder();
            foreach (byte num in stream.ToArray())
             {
                 builder.AppendFormat("{0:X2}", num);
             }
             stream.Close();
            return builder.ToString();
         }
        /// <summary>
        /// Des 解密 GB2312 
        /// </summary>
        /// <param name="str">Desc string</param>
        /// <param name="key">Key ,必須為8位 </param>
        /// <returns></returns>
        public static string Decode(string str, string key)
         {
             DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
             provider.Key = Encoding.ASCII.GetBytes(key.Substring(0, 8));
             provider.IV = Encoding.ASCII.GetBytes(key.Substring(0, 8));
            byte[] buffer = new byte[str.Length / 2];
            for (int i = 0; i < (str.Length / 2); i++)
             {
                int num2 = Convert.ToInt32(str.Substring(i * 2, 2), 0x10);
                 buffer[i] = (byte)num2;
             }
             MemoryStream stream = new MemoryStream();
             CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write);
             stream2.Write(buffer, 0, buffer.Length);
             stream2.FlushFinalBlock();
             stream.Close();
            return Encoding.GetEncoding("GB2312").GetString(stream.ToArray());
         }
首頁 → 網站編程 → Asp.Net編程教程 → ASP.NET實現URL加密與解密ASP.NET實現URL加密與解密
時間:2009-8-25 16:13:18 來源:hi..com 作者:webmaster 
-
-
調用方法
/// <summary>
        /// If don't input key , Use default key
        /// Des 加密 GB2312 :
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string Encode(string str)
        {
            return VerifyTool.Encode(str, "Rainight");
        }
        /// <summary>
        /// 解密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string Decode(string str)
        {
            return VerifyTool.Decode(str, "Rainight");
        }
㈩ asp.net如何進行用戶名和密碼的加密和解密
直接給代碼吧
using System.Web.Security;
string str= FormsAuthentication.(TextBox1.text, "MD5")
把TextBox1里的內容用MD5加密返回給str
MD5為不可逆加密所以不可解密,你只有再次加密與加密後的密碼匹配來判斷是否正確
