首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> ASP.NET 基礎 >> 關於ASP.NET

Enterprise Library 2.0 Hands On Lab 翻譯(15):加密應用程式區塊(二)

     編輯:關於ASP.NET

練習 2:使用雜湊加密密碼

將密碼雜湊後儲存於 XML 檔案中。

步驟 1:開啟專案

開啟 BugSmak.sln,預設路徑 C:\Program Files\Microsoft Enterprise Library January 2006\labs\cs\Cryptography\exercises\ex02\begin,編譯專案。

步驟 2:回顧應用程式

  1. 選 Debug → Start Without Debugging 執行
  2. 應用程式管理 XML 中的使用者帳密。新增使用者 Elmo,密碼預設 P@ssw0rd
  3. 新增使用者介面

  4. 點擊 Save 儲存至 UserStore.config
  5. 關閉應用程式
  6. 開啟 UserStore.config,發現密碼以明文儲存:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="userStore" type="UserStore.Configuration.UserSettings, UserStore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </configSections>
  <userStore>
    <users>
      <add name="Elmo" password="P@ssw0rd" />
      <add name="Zoe" password="P@ssw0rd" />
    </users>
  </userStore>
</configuration>

後續練習將示範如何使用 Cryptography Application Block 將密碼雜湊後再儲存。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved