public Stream Write(Stream stream, byte[] key) { var crypto = new FantasyTennisRijndaelEngine(); crypto.Init(true, new KeyParameter(key)); stream.Write(new byte[] { 6 }); return(new CryptoStream(stream, crypto, CryptoStreamMode.Write)); }
public Stream Read(Stream stream, byte[] key) { var crypto = new FantasyTennisRijndaelEngine(); crypto.Init(false, new KeyParameter(key)); crypto.ControlByte = (byte)stream.ReadByte(); return(new CryptoStream(stream, crypto, CryptoStreamMode.Read)); }