// Methods public StreamCtx() { this.ibc = null; this.iv = null; this.mode = StreamCipher.Mode.CBC; this.fReadOnly = false; }
/// <summary> /// creates the context to be used by the other methods /// once created the context is readonly /// use always this method (or its overwrites) to obtain a context /// </summary> /// <param name="ibc">this method will call InitCipher, you dot not need to call it before</param> /// <param name="key">make sure the length of the key is as required /// some ciphers have key size restrictions</param> /// <param name="iv">is ignored in EBC mode</param> /// <param name="mode"></param> /// <returns></returns> public static StreamCtx MakeStreamCtx(IBlockCipher ibc, byte[] key, byte[] iv, StreamCipher.Mode mode) { StreamCtx ctx = new StreamCtx(); ctx.Ibc = ibc; ctx.Ibc.InitCipher(key); ctx.IV = iv; ctx.Mode = mode; ctx.MakeReadOnly(); return(ctx); }