[winphone][C#] RSA加密与解密
来源:互联网 发布:怎样设计淘宝店铺 编辑:程序博客网 时间:2024/06/05 04:32
RSA加密(分片加密,每片最大长度117)
const int RSA_PIECE_LENGTH = 117;//xml格式的密钥
public static byte[] RSAEncypt(byte[] contentBytes, string key) { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(key); byte[] oText = contentBytes; List<byte[]> pieceList = new List<byte[]>(); List<byte> oTextList = new List<byte>(); oTextList.AddRange(oText); int pieces = oText.Length / RSA_PIECE_LENGTH + 1; //分片 for (int i = 0; i < pieces; i++) { int index = i * RSA_PIECE_LENGTH; byte[] bytes = oTextList.GetRange(index, index + RSA_PIECE_LENGTH > oTextList.Count ? oTextList.Count - index : RSA_PIECE_LENGTH).ToArray(); pieceList.Add(bytes); } List<byte> cipherList = new List<byte>(); for (int i = 0; i < pieceList.Count; i++) { byte[] cbs = rsa.Encrypt(pieceList[i], false); cipherList.AddRange(cbs); } rsa.Dispose(); return cipherList.ToArray(); }
- [winphone][C#] RSA加密与解密
- RSA加密与解密
- RSA加密与解密
- Rsa 加密与解密
- RSA加密与解密
- RSA加密与解密
- RSA加密与解密
- RSA加密与解密
- RSA的加密与解密
- rsa加密与解密算法
- rsa加密与解密算法
- IOS rsa加密与解密
- RSA加密解密与签名
- RSA简单加密与解密
- RSA加密,解密 与数字签名
- C# RSA加密与解密
- iOS RSA 加密与解密
- 【C#】RSA 密钥生成 加密 解密
- 64位windows2003读取xls文件设置
- Java桌面程序打包成exe可执行文件
- SGU223 状态压缩DP
- gridcontrol根据条件设置grid颜色显示
- linux平台开发有用的一些知识点. 持续更新.
- [winphone][C#] RSA加密与解密
- mongodb linq查询
- Bash 内置函数及其它
- mysql高性能学习笔记整理
- 工作两年~跌跌撞撞
- android下ListView的奇异异常大集合(持续更新)
- 【分治】求逆序对个数并打印逆序对
- 快速排序的时间复杂度计算
- SharePoint 2010新手入门