将 Rijndaelmanged() byte[] 转换为字符串
我想将 Rijndaemanagement() 加密值转换为字符串。
ToBase64String() 就足够了吗? 它说它仅适用于 8 位数组,但 AES 是 128 位,对吗?
更新
对于加密,我使用http: //msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanagement.aspx
I want to convert the Rijndaemanaged() encrpted value to a string.
Will ToBase64String() suffice? It says its only for 8-bit arrays, but AES is 128 bit right?
Update
For the encrption, I am using the code from http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Base64 通常是一个不错的选择。 它相当高效,并且您通常不需要担心编码问题,因为结果将是 ASCII。 但是,如果要在 URL 中使用结果,您可能应该小心 - “正常”Base64 不是 url 安全的。 (不过,还有使用不同符号的替代编码。)
Base64 is a generally good way to go. It's reasonably efficient, and you usually don't need to worry about encoding issues as the result will be ASCII. However, you should probably be careful if you're going to use the result in a URL - "normal" Base64 isn't url-safe. (There are alternative encodings which use different symbols though.)
字节就是字节=8位。 ToBase64String 可以工作。 正如 Jon 指出的,它在 url 或文件名中使用它有局限性。
您可以使用 this 将其转换为十六进制字符串。
Byte is byte = 8bits. ToBase64String will work. As Jon points out, it has limitations in using it in urls or filenames.
You can use this to convert it to a hex string.
多年来,我们一直在托管 Rijndael 的加密字节上成功使用 Convert.ToBase64String。
We have been succesfully using Convert.ToBase64String on the encrypted bytes from managed Rijndael for number of years.