public override byte[] ToBytes() { byte[] contents = new byte[8]; /* authentication instruction */ BitArray authenticationInstruction = new BitArray(8, false); authenticationInstruction.Set(0, TargetSpecificSuId); authenticationInstruction.Set(1, DeleteAllKeys); authenticationInstruction.CopyTo(contents, 0); /* suid */ byte[] suId = SuId.ToBytes(); Array.Copy(suId, 0, contents, 1, suId.Length); return(contents); }
public override byte[] ToBytes() { int length = 14 + Key.Length; byte[] contents = new byte[length]; /* DECRYPTION INSTRUCTION BLOCK */ /* decryption instruction format */ contents[0] = 0x00; /* outer algorithm id */ contents[1] = (byte)AlgorithmId.Clear; /* key id */ contents[2] = 0x00; contents[3] = 0x00; /* AUTHENTICATION BLOCK */ /* authentication instruction */ BitArray authenticationInstruction = new BitArray(8, false); authenticationInstruction.Set(0, TargetSpecificSuId); authenticationInstruction.CopyTo(contents, 4); /* suid */ byte[] suId = SuId.ToBytes(); Array.Copy(suId, 0, contents, 5, suId.Length); /* inner algoritm id */ contents[12] = (byte)InnerAlgorithmId; /* key length */ contents[13] = (byte)Key.Length; /* key data */ Array.Copy(Key, 0, contents, 14, Key.Length); return(contents); }