C#.NET史上最全字符串加密/解密/数字签名工具(CryptoHelper.cs)
C#.NET史上最全字符串加密/解密/数字签名工具(CryptoHelper.cs)
CryptoHelper 测试 C# Code: string text = "www.csframework.com/www.cscode.net C/S框架网测试"; txtResponse.Text = CryptoHelper.ToMD5(text); MessageBox.Show("ToMD5:" txtResponse.Text); txtResponse.Text = CryptoHelper.ToSHA256Hash(text); MessageBox.Show("ToSHA256Hash:" txtResponse.Text); txtResponse.Text = CryptoHelper.ToSHA512Hash(text); MessageBox.Show("ToSHA512Hash:" txtResponse.Text); string privateKey; string publicKey; CryptoHelper.DSAGetKey(out privateKey, out publicKey); txtResponse.Text = CryptoHelper.DSASign(text, privateKey); MessageBox.Show("DSASign:" txtResponse.Text); bool ss = CryptoHelper.DSAVerify(text, txtResponse.Text, publicKey); txtResponse.Text = ss ? "验证成功" : "验证失败"; MessageBox.Show("DSAVerify:" txtResponse.Text); CryptoHelper.RSAGetKey(out privateKey, out publicKey); txtResponse.Text = CryptoHelper.RSAEncrypt(text, publicKey); MessageBox.Show("RSAEncrypt:" txtResponse.Text); txtResponse.Text = CryptoHelper.RSADecrypt(txtResponse.Text, privateKey); MessageBox.Show("RSADecrypt:" txtResponse.Text); txtResponse.Text = CryptoHelper.RSASign(text, privateKey); MessageBox.Show("RSASign:" txtResponse.Text); bool ok = CryptoHelper.RSAVerify(text, txtResponse.Text, publicKey); txtResponse.Text = ok ? "验证成功" : "验证失败"; MessageBox.Show("RSAVerify:" txtResponse.Text); txtResponse.Text = CryptoHelper.TripleDESEncrypt(text, "ABCDEFGHIJKLMNOP", "12345678"); MessageBox.Show(CryptoHelper.TripleDESDecrypt(txtResponse.Text, "ABCDEFGHIJKLMNOP", "12345678")); txtResponse.Text = CryptoHelper.RijndaelEncrypt(text, "12345678", "12345678"); MessageBox.Show(CryptoHelper.RijndaelDecrypt(txtResponse.Text, "12345678", "12345678")); txtResponse.Text = CryptoHelper.DESEncrypt(text, "12345678", "12345678"); MessageBox.Show(CryptoHelper.DESDecrypt(txtResponse.Text, "12345678", "12345678")); //来源:C/S框架网(www.csframework.com) QQ:1980854898 CryptoHelper.cs下载: 扫一扫加作者微信
参考文档:
StrUtils类:字符串处理/加密解密函数库 C#.NET 处理字符串数据去左右空格、全角转半角 C#.NET 对象(字符串)转换常用扩展方法 C#.NET 定义动态对象dynamic以及转换JSON字符串 C#日期类型转换工具(时间戳,字符串,long,byte类型互转) 推荐基于C/S架构的软件开发工具(Winform+C#语言+ADO.NET+代码生成器) LianLianPay连连支付数字签名验签工具C#源码 C#正则表达式查找或替换指定字符串(标识)范围的内容 基于C#.NET MES软件开发工具MES系统开发框架 CSFrameworkV5.DemoTester测试加密解密工具 WebApi接口安全之用户认证防篡改数字签名(Data Sign)机制 C# GUID序列号转换生成唯一的16位短字符串或19位长数字序号 C# Rijndael Encrypt加密/Decrypt解密算法 C# MD5字符串文本加密 C# 将GUID转换为最长16位的短字符串序号
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 | |