public byte[] GenerateKey() { while (true) { rc2.GenerateKey(); if (UTF8Encoding.UTF8.GetString(rc2.Key).IndexOf("'") == -1 && UTF8Encoding.UTF8.GetString(rc2.Key).IndexOf((char)34) == -1) { return(rc2.Key); } } }
public Cryptographer() { this.rc2 = new RC2CryptoServiceProvider(); this.rc2.KeySize = 128; EncryptionKey = GetDefaultKey(); IV = GetDefaultVector(); rc2.GenerateKey(); rc2.Key = EncryptionKey; rc2.GenerateIV(); rc2.IV = IV; }