开发者

Cannot use SHA-512 in Silverlight?

pdf: Web Client Integration via URL says:

Ascertaining an SHA-512 hash from the passphrase (result 512 bits). This can be implemented in .NET using the SHA512Managed-class The problem is that my project is in SilverLight and SHA512Managed is not available for Silverlight nor is another implementation available for SilverLight right now.

So basically I am blocked at SHA512 step:

var passphrase = "mypassphrase";

byte[] byteValue = (new SHA512Managed()).ComputeHash(System.Text.Encoding.UTF8.GetBytes(passphrase));
byte[] key = new byte[32];
byte[] iv = new byte[16];
Array.Copy(byteValue, key, 32);
Array.Copy(byteValue, 32, iv, 0, 16);

// Declare the stream used to encrypt to a开发者_开发知识库n in memory
// array of bytes.
MemoryStream msEncrypt = null;

// Create a RijndaelManaged object
// with the specified key and IV.
aesAlg = new AesManaged();
aesAlg.Key = key;
aesAlg.IV = iv;

Can you please let me know if is there any other way to encode the url ?


Mono has an implementation you could probably use, provided you are happy with the OS license.

https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜