当前位置: 首页>>代码示例>>C#>>正文


C# RijndaelManaged.GenerateIV方法代码示例

本文整理汇总了C#中RijndaelManaged.GenerateIV方法的典型用法代码示例。如果您正苦于以下问题:C# RijndaelManaged.GenerateIV方法的具体用法?C# RijndaelManaged.GenerateIV怎么用?C# RijndaelManaged.GenerateIV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RijndaelManaged的用法示例。


在下文中一共展示了RijndaelManaged.GenerateIV方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateEncryptionVector

 /// Generates a unique encryption vector
 public static byte[] GenerateEncryptionVector()
 {
     //Generate a Vector
     RijndaelManaged rm = new RijndaelManaged();
     rm.GenerateIV();
     return rm.IV;
 }
开发者ID:skuffe,项目名称:MailClient,代码行数:8,代码来源:SimpleAES.cs

示例2: Main

	static void Main(string[] args)
	{
		using (var rijndael = new RijndaelManaged())
		using (var hmacsha256 = new HMACSHA256())
		{
			rijndael.GenerateKey();
			rijndael.GenerateIV();
			hmacsha256.Initialize();
			Console.WriteLine(template,	new SoapHexBinary(rijndael.Key), new SoapHexBinary(rijndael.IV), new SoapHexBinary(hmacsha256.Key));
		}

		Console.WriteLine("press any key to exit...");
		Console.ReadKey();
	}
开发者ID:ChrisMissal,项目名称:AppHarbor.Web.Security,代码行数:14,代码来源:Program.cs

示例3: CreateRijndaelIv

    // create Rijndael initialization vector
    private static byte[] CreateRijndaelIv()
    {
        byte[] rijndaelIv;
        using (var myRijndael = new RijndaelManaged())
        {
            myRijndael.Mode = CipherMode.CBC;
            myRijndael.KeySize = 256;
            myRijndael.BlockSize = 256;
            myRijndael.Padding = PaddingMode.Zeros;
            myRijndael.GenerateIV();
            rijndaelIv = myRijndael.IV;
        }

        return rijndaelIv;
    }
开发者ID:preactor,项目名称:SolarschiffGame,代码行数:16,代码来源:EncryptionHelper.cs

示例4: EncryptMessage

    public static string EncryptMessage(byte[] text, string key)
    {
        RijndaelManaged aes = new RijndaelManaged();
        aes.KeySize = 256;
        aes.BlockSize = 256;
        aes.Padding = PaddingMode.Zeros;
        aes.Mode = CipherMode.CBC;

        aes.Key = Encoding.Default.GetBytes(key);
        aes.GenerateIV();

        string IV = ("-[--IV-[-" + Encoding.Default.GetString(aes.IV));

        ICryptoTransform AESEncrypt = aes.CreateEncryptor(aes.Key, aes.IV);
        byte[] buffer = text;

        return Convert.ToBase64String(Encoding.Default.GetBytes(Encoding.Default.GetString(AESEncrypt.TransformFinalBlock(buffer, 0, buffer.Length)) + IV));
    }
开发者ID:kimsama,项目名称:AES-256-CBC-Test,代码行数:18,代码来源:MessageUtil.cs


注:本文中的RijndaelManaged.GenerateIV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。