using System;
using System.Collections.Generic;
using System.Security.Cryptography;
namespace Lidgren.Network
{
///
/// Interface for an encryption algorithm
///
public abstract class NetEncryption
{
///
/// NetPeer
///
protected NetPeer m_peer;
///
/// Constructor
///
public NetEncryption(NetPeer peer)
{
if (peer == null)
throw new NetException("Peer must not be null");
m_peer = peer;
}
public void SetKey(string str)
{
var bytes = System.Text.Encoding.ASCII.GetBytes(str);
SetKey(bytes, 0, bytes.Length);
}
public abstract void SetKey(byte[] data, int offset, int count);
///
/// Encrypt an outgoing message in place
///
public abstract bool Encrypt(NetOutgoingMessage msg);
///
/// Decrypt an incoming message in place
///
public abstract bool Decrypt(NetIncomingMessage msg);
}
}