C#.NET史上最全字符串加密/解密/数字签名工具(CryptoHelper.cs)


  C#.NET史上最全字符串加密/解密/数字签名工具(CryptoHelper.cs)
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


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
C/S框架网
上一篇:CSFramework企业版-增加我的设置(用户参数设置)
下一篇:C#.NET 身份证号码格式正则表达式验证
评论列表

发表评论

评论内容
昵称:
关联文章

C#.NET字符串加密/解密/数字签名工具(CryptoHelper.cs)
C# Rijndael Encrypt加密/Decrypt解密算法
WebApi接口安全之用户认证防篡改数字签名(Data Sign)机制
数字签名(Data Sign)+存取令牌(Access Token)双重安全请求WebApi接口
CSFrameworkV5.DemoTester测试加密解密工具
【原创】C# IKVM加密解密机AES对称加密模式AES-128-ECB,补码方式 PKCS5Padding
LianLianPay连连支付数字签名验签工具C#源码
KeyProvider.KeyProviderRijndael对称加密算法使用|开发框架加密工具
StrUtils类:字符串处理/加密解密函数库
CSFramework.WebApiV3.Data Sign – 接口数据加密(签名)
CSFramework.WebApiV3.Data Sign – 接口数据加密(签名)
C#OOP面向对象程序设计源代码(Car.cs)
关于C/S快速开发框架采用的文本加密解密策略|C/S框架网
加密解密tb_DataSet/tb_MyUser表的密码|C/S框架网
C#.NET 处理字符串数据去左右空格、角转半角
C# MD5字符串文本加密
C#OOP设计思想之汽车模型源代码
C# GUID序列号转换生成唯一的16位短字符串或19位长数字序号
推荐C#.Net逆向反编译四大软件工具
SQL注入漏洞接触--入门篇

热门标签
.NET5 .NET6 .NET7 APP Auth-软件授权注册系统 Axios B/S B/S开发框架 Bug Bug记录 C#加密解密 C#源码 C/S CHATGPT CMS系统 CodeGenerator CSFramework.DB CSFramework.EF CSFrameworkV1学习版 CSFrameworkV2标准版 CSFrameworkV3高级版 CSFrameworkV4企业版 CSFrameworkV5旗舰版 CSFrameworkV6.0 DAL数据访问层 Database datalock DbFramework Demo教学 Demo下载 DevExpress教程 DOM EF框架 Element-UI EntityFramework ERP ES6 Excel FastReport GIT HR IDatabase IIS JavaScript LINQ MES MiniFramework MIS NavBarControl Node.JS NPM OMS ORM PaaS POS Promise API Redis SAP SEO SQL SQLConnector TMS系统 Token令牌 VS2022 VSCode VUE WCF WebApi WebApi NETCore WebApi框架 WEB开发框架 Windows服务 Winform 开发框架 Winform 开发平台 WinFramework Workflow工作流 Workflow流程引擎 版本区别 报表 踩坑日记 操作手册 代码生成器 迭代开发记录 基础资料窗体 架构设计 角色权限 开发sce 开发技巧 开发教程 开发框架 开发平台 开发指南 客户案例 快速搭站系统 快速开发平台 秘钥 密钥 权限设计 软件报价 软件测试报告 软件简介 软件开发框架 软件开发平台 软件开发文档 软件体系架构 软件下载 软著证书 三层架构 设计模式 生成代码 实用小技巧 收钱音箱 数据锁 数据同步 微信小程序 未解决问题 文档下载 喜鹊ERP 喜鹊软件 系统对接 详细设计说明书 行政区域数据库 需求分析 疑难杂症 蝇量级框架 蝇量框架 用户管理 用户开发手册 用户控件 在线支付 纸箱ERP 智能语音收款机 自定义窗体 自定义组件 自动升级程序