public DeleteAuthenticationKeyCommand(bool targetSpecificSuId, bool deleteAllKeys, SuId suId) { if (suId == null) { throw new ArgumentNullException("suId"); } TargetSpecificSuId = targetSpecificSuId; DeleteAllKeys = deleteAllKeys; SuId = suId; }
public void Parse(byte[] contents) { if (contents.Length != 8) { throw new ArgumentOutOfRangeException("contents", string.Format("length mismatch - expected 7, got {0} - {0}", contents.Length.ToString(), BitConverter.ToString(contents))); } /* suid */ byte[] suId = new byte[7]; Array.Copy(contents, 0, suId, 0, 7); SuId = new SuId(suId); /* k status */ KeyAssigned = Convert.ToBoolean(contents[7] & 0x01); ActiveSuId = Convert.ToBoolean(contents[7] & 0x02); }
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 LoadAuthenticationKeyCommand(bool targetSpecificSuId, SuId suId, byte[] key) { if (suId == null) { throw new ArgumentNullException("suId"); } if (key.Length != 16) { throw new ArgumentOutOfRangeException("key", string.Format("length mismatch - expected 16, got {0} - {1}", key.Length.ToString(), BitConverter.ToString(key))); } TargetSpecificSuId = targetSpecificSuId; SuId = suId; InnerAlgorithmId = AlgorithmId.AES128; Key = key; }
protected override void Parse(byte[] contents) { if (contents.Length != 9) { throw new ArgumentOutOfRangeException("contents", string.Format("length mismatch - expected 9, got {0} - {1}", contents.Length.ToString(), BitConverter.ToString(contents))); } /* authentication instruction */ AssignmentSuccess = Convert.ToBoolean(contents[0] & 0x01); /* suid */ byte[] suId = new byte[7]; Array.Copy(contents, 1, suId, 0, 7); SuId = new SuId(suId); /* status */ Status = (Status)contents[8]; }
protected override void Parse(byte[] contents) { if (contents.Length != 10) { throw new ArgumentOutOfRangeException("contents", string.Format("length mismatch - expected 10, got {0} - {1}", contents.Length.ToString(), BitConverter.ToString(contents))); } /* suid */ byte[] suId = new byte[7]; Array.Copy(contents, 0, suId, 0, 7); SuId = new SuId(suId); /* number of keys deleted */ NumKeysDeleted |= (contents[7] & 0xFF) << 8; NumKeysDeleted |= contents[8] & 0xFF; /* status */ Status = (Status)contents[9]; }
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); }
protected override void Parse(byte[] contents) { if (contents.Length != 10) { throw new ArgumentOutOfRangeException("contents", string.Format("length mismatch - expected 10, got {0} - {1}", contents.Length.ToString(), BitConverter.ToString(contents))); } /* inventory type */ InventoryType = (InventoryType)contents[0]; /* inventory instruction */ ActiveSuId = Convert.ToBoolean(contents[1] & 0x01); KeyAssigned = Convert.ToBoolean(contents[1] & 0x02); /* suid */ byte[] suId = new byte[7]; Array.Copy(contents, 2, suId, 0, 7); SuId = new SuId(suId); /* status */ Status = (Status)contents[9]; }
public override string ToString() { return(string.Format("[TargetSpecificSuId: {0}, DeleteAllKeys: {1}, SuId: {2}]", TargetSpecificSuId, DeleteAllKeys, SuId.ToString())); }
public override string ToString() { return(string.Format("[AssignmentSuccess: {0}, SuId: {1}, Status: {2} (0x{3:X2})]", AssignmentSuccess, SuId.ToString(), Status.ToString(), (byte)Status)); }
public override string ToString() { return(string.Format("[TargetSpecificSuId: {0}, SuId: {1}, InnerAlgorithmId: {2} 0x{3:X2}, Key (hex): {4}]", TargetSpecificSuId, SuId.ToString(), InnerAlgorithmId.ToString(), (byte)InnerAlgorithmId, BitConverter.ToString(Key))); }
public override string ToString() { return(string.Format("[ActiveSuId: {0}, KeyAssigned: {1}, SuId: {2}, Status: {3} (0x{4:X2})]", ActiveSuId, KeyAssigned, SuId.ToString(), Status.ToString(), (byte)Status)); }
public override string ToString() { return(string.Format("[SuId: {0}, KeyAssigned: {1}, ActiveSuId: {2}]", SuId.ToString(), KeyAssigned, ActiveSuId)); }
public override string ToString() { return(string.Format("[SuId: {0}, NumKeysDeleted: {1}, Status: {2} (0x{3:X2})]", SuId.ToString(), NumKeysDeleted, Status.ToString(), (byte)Status)); }