C# 加密-Rijndael
Rijndael
属对称加密,对称加密在加密和解密时都使用相同的密钥。2000 年 10 月,NIST 选择 Rijndael(发音为 "Rhine dale")作为 AES 算法,用以取代 DES。
Rijndael 的名称空间是:
System.Security.Cryptography
byte[] plaintextBuffer = System.Text.Encoding.UTF8.GetBytes("明文");
//加密
Rijndael rijndael = Rijndael.Create();
ICryptoTransform transform = rijndael.CreateEncryptor();
byte[] cipherTextBuffer = transform.TransformFinalBlock(plaintextBuffer, 0, plaintextBuffer.Length);
lbl.Text = Convert.ToBase64String(cipherTextBuffer) + "<br />";
transform.Dispose();
//解密
Rijndael rijndael2 = Rijndael.Create();
ICryptoTransform transform2 = rijndael2.CreateDecryptor(rijndael.Key, rijndael.IV);
byte[] decryption = transform2.TransformFinalBlock(cipherTextBuffer, 0, cipherTextBuffer.Length);
lbl.Text += System.Text.Encoding.UTF8.GetString(decryption) + "<br />";
transform2.Dispose();
解密时,使用加密的 Key 和 IV。
相关文档:
手机音乐播发器里有总文件总时间的统计,在酷狗播放器里找了一下没找到。那我想知道这些歌曲的总时间,该怎么办?
其实很简单,稍稍动动手,就能找到答案!
请参考如下步骤:
第一步,保存播放列表,把里面的歌曲保存到一个你喜欢的名字。
第二步,在播放列表上面点右键,到处播放列表到你找的到的地方。
经测试,最新 ......
styleObj用于设置图层的符号。它在classObj中定义,一般于symbolObj一起使用。通过设置styleObj,可以产生千变万化,丰富多彩的地图。
一个简单的styleObj示例:
CLASS
NAME "Primary Roads"
STYLE
SYMBOL "circle"
COLOR 178 114 1
SIZE 15
END #style1
STYLE
SYMBOL "circle"
COLOR 254 161 0
SIZE 7
END #s ......
最近着实忙了一阵子,学习了好多东东都没时间整理,呵呵,总算是要放假了,可以好好归纳归纳了。
设计模式的学习是一个任重而道远的过程了,^_^,要好好总结,总结的目的是让自己好好记住,记住的目的是便于理解,而理解的最终目的是应用,O(∩_∩)O~ 而设计模式也往往是应用的一种重构,循环往复,生生不息啊... .. ......
RSA
实际应用中是:接收方产生公钥和私钥,发送方用其公钥加密,再把加密后的内容发送给接收方。
CspParameters
的名称空间是:
System.Security.Cryptography
CspParameters cpSend = new CspParameters(); //Csp = Cryptography Service Provider
CspParameters cpReceive = new CspParameters();
cpSend.KeyCon ......