Exemple #1
0
 /// <summary>
 /// Transmit a blob to the given network stream
 /// </summary>
 /// <param name="stm"></param>
 /// <param name="tpmBlob"></param>
 public static void SendBlob(Stream stm, TPMBlob tpmBlob)
 {
     // We need to have a valid size when working over the network
     // Disabled for now - tpmBlob.WriteCmdSize();
     //tpmBlob.WriteCmdSize();
     RawSendBlob(stm, tpmBlob.GetBuffer(), (int)tpmBlob.Length);
 }
Exemple #2
0
        /// <summary>
        /// Transmit support for TpmMemoryStreams.
        /// </summary>
        /// <param name="instm"></param>
        /// <param name="writeSize"></param>
        /// <returns></returns>
        public TPMBlob Transmit(TPMBlob instm, bool writeSize)
        {
            if (writeSize)
            {
                instm.WriteCmdSize();
            }

            byte[] inblob = instm.GetBuffer();

            if (_debug)
            {
                _logger.DebugFormat("send --> 0x{0}", ByteHelper.ByteArrayToHexString(instm.ToArray(), " "));
            }

            byte[] outblob = Transmit(inblob, (int)instm.Length);

            if (_debug)
            {
                _logger.DebugFormat("received --> 0x{0}", ByteHelper.ByteArrayToHexString(outblob, " "));
            }

            return(new TPMBlob(outblob));
        }