public byte[] ToEncoding() { if (EncodedFile.Count() == 0) { return(null); } var encodeStream = new MemoryStream(); var binaryWriter = new BinaryWriter(encodeStream); binaryWriter.Write(EncodedFile.GetEncodings()); TLV cmMIC = new TLVCMMIC(EncodedFile); binaryWriter.Write(cmMIC.ToEncoding()); EncodedFile.Add(cmMIC); binaryWriter.Write((new TLVCMTSMIC(EncodedFile, Secret).ToEncoding())); TLV EndOfBataMkr = new TLVSpecial(); // Add EndOfDataMkr before making the MD5 binaryWriter.Write(EndOfBataMkr.ToEncoding()); return(encodeStream.ToArray()); }
public void setValue(TLVList tlvEncodings) { tlvInit = false; tlvValue = null; tlvLength = 0; if (tlvEncodings == null) { return; } MD5 md5Hasher = MD5.Create(); byte[] Master = tlvEncodings.GetEncodings(); md5Hasher.ComputeHash(Master, 0, Master.Length); tlvValue = md5Hasher.Hash; string sResult = BitConverter.ToString(tlvValue); tlvLength = tlvValue.Length; tlvInit = true; }