将 Rijndaelmanged() byte[] 转换为字符串

发布于 2024-07-08 22:02:43 字数 513 浏览 7 评论 0原文

我想将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

翻身的咸鱼 2024-07-15 22:02:43

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.)

夢归不見 2024-07-15 22:02:43

字节就是字节=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.

素衣风尘叹 2024-07-15 22:02:43

多年来,我们一直在托管 Rijndael 的加密字节上成功使用 Convert.ToBase64String。

We have been succesfully using Convert.ToBase64String on the encrypted bytes from managed Rijndael for number of years.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文