我搜索了这个问题并找到了解决方案,但我发现钥匙有时会产生于64,63,62或61我不知道为什么任何人都可以帮助我 并感谢您的帮助
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] buff = new byte[8];
rng.GetBytes(buff);
StringBuilder hexString = new StringBuilder(64);
for (int counter = 0; counter < buff.Length; counter++)
{
hexString.Append(String.Format("{0:X2}", buff[counter]));
}
string Key = hex2binary(hexString.ToString());