I want to convert the Rijndaemanaged() encrpted value to a string.
我想将Rijndaemanaged()encrpted值转换为字符串。
Will ToBase64String() suffice? It says its only for 8-bit arrays, but AES is 128 bit right?
ToBase64String()会不够?它说它只适用于8位阵列,但AES是128位吗?
Update
For the encrption, I am using the code from http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx
对于加密,我使用的代码来自http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx
3 个解决方案
#1
3
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.)
Base64是一个很好的方法。它的效率相当高,而且您通常不需要担心编码问题,因为结果将是ASCII。但是,如果您要在URL中使用结果,您应该小心 - “正常”Base64不是url-safe。 (虽然有其他编码使用不同的符号。)
#2
0
Byte is byte = 8bits. ToBase64String will work. As Jon points out, it has limitations in using it in urls or filenames.
字节是字节= 8位。 ToBase64String将起作用。正如Jon指出的那样,在网址或文件名中使用它有局限性。
You can use this to convert it to a hex string.
您可以使用它将其转换为十六进制字符串。
#3
0
We have been succesfully using Convert.ToBase64String on the encrypted bytes from managed Rijndael for number of years.
我们已经成功地使用Convert.ToBase64String对托管Rijndael的加密字节进行了多年的处理。
#1
3
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.)
Base64是一个很好的方法。它的效率相当高,而且您通常不需要担心编码问题,因为结果将是ASCII。但是,如果您要在URL中使用结果,您应该小心 - “正常”Base64不是url-safe。 (虽然有其他编码使用不同的符号。)
#2
0
Byte is byte = 8bits. ToBase64String will work. As Jon points out, it has limitations in using it in urls or filenames.
字节是字节= 8位。 ToBase64String将起作用。正如Jon指出的那样,在网址或文件名中使用它有局限性。
You can use this to convert it to a hex string.
您可以使用它将其转换为十六进制字符串。
#3
0
We have been succesfully using Convert.ToBase64String on the encrypted bytes from managed Rijndael for number of years.
我们已经成功地使用Convert.ToBase64String对托管Rijndael的加密字节进行了多年的处理。