CSharp examples for System.Security.Cryptography:Key
Make Key with key size 128
using System.Text; using System.Security.Cryptography; using System;/*from ww w .j av a2 s . c om*/ using Org.BouncyCastle.Utilities.Encoders; public class Main{ public static string MakeKey(int keySize = 128) { var aesCryptoServiceProvider = new AesCryptoServiceProvider(); aesCryptoServiceProvider.KeySize = keySize; aesCryptoServiceProvider.GenerateKey(); byte[] key = aesCryptoServiceProvider.Key; return Convert.ToBase64String(key); } }