using System; using System.Diagnostics; namespace TwlBackupBlock { /// /// データブロックです。 /// public class Block : ICloneable { private const int MAC_SIZE = 16; private const int IV_SIZE = 16; public AbstractBody body; public byte[] mac; public byte[] iv; /// /// Blockクラスの新しいインスタンスを初期化します。 /// public Block() { body = null; mac = null; iv = null; } /// /// 指定したデータ本体、MAC、IVを使用して、Blockクラスの新しいインスタンスを初期化します。 /// /// データ本体。 /// MAC。 /// IV。 public Block(AbstractBody body, byte[] mac, byte[] iv) { Debug.Assert(mac.Length == MAC_SIZE); Debug.Assert(iv.Length == IV_SIZE); this.body = body; this.mac = mac; this.iv = iv; } /// /// Blockのディープコピーを作成します。 /// /// public object Clone() { return new Block((AbstractBody)body.Clone(), (byte[])mac.Clone(), (byte[])iv.Clone()); } } }