您的位置:首页 > 移动开发

加密应用程序块 Cryptopgraphy Application Block

2016-04-12 21:58 369 查看
企业库加密应用程序模块的功能如下:
(1)减少了需要编写的模版代码,解决常见的应用程序加解密的问题。
(2)在跨企业和应用程序之间提供一致的加/解密策略。
(3)允许管理员进行加密配置,包括使用组策略。
(4)可扩展,支持用户自定义加/解密技术。

企业库加密应用程序模块提供了两种方式让用户保护自己的数据:
(1)Hashingproviders:离散加密法,简单来说就是把用户的信息保存到内存中后用一个离散值表示并返回给程序,这样再程序中只能看到离散值而不是明文。
(2)Cryptographyproviders:密钥加密法,用对称加密方法对数据进行加密(尚未支持非对称加密)。





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;

namespace Cryptography
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
//获取离散变量
string hash = Cryptographer.CreateHash("SHA256Managed", "bjxingch");
//输出显示
label1.Text = hash;
//验证
bool equal = Cryptographer.CompareHash("SHA256Managed", "bjxingch", hash);

//输出验证结果
if (equal)
{
label1.Text = "正确";
}
else
{
label1.Text = "错误";
}
}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Microsoft 管理员 加密