Exemplo n.º 1
0
 /// <summary>
 /// 创建签名秘钥
 /// </summary>
 /// <param name="lenght">签名秘钥字节长度</param>
 /// <returns>签名Key Base64字符串</returns>
 public static String CreatedSignKey(int lenght = 32)
 {
     return(CryptoTransform.CreateKey(lenght));
     //byte[] bytes = new Byte[lenght];
     //using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
     //{
     //    rng.GetBytes(bytes);
     //    return Convert.ToBase64String(bytes);
     //}
 }
Exemplo n.º 2
0
 public static String CreateKeyNoIv()
 {
     return(CryptoTransform.CreateKey(32));
 }