Example #1
0
 public ResponseAuthHandleInfoCore(TPMBlob blob, long startIndex)
 {
     blob.Seek(startIndex, SeekOrigin.Begin);
     _nonceEven           = blob.ReadBytes(20);
     _continueAuthSession = blob.ReadBool();
     _tpmAuthData         = blob.ReadBytes(20);
 }
Example #2
0
        public void ReadFromTpmBlob(TPMBlob blob)
        {
            _version         = CapabilityDataCore.TPMVersionCore.CreateFromTPMBlob(blob);
            _keyUsage        = (TPMKeyUsage)blob.ReadUInt16();
            _keyFlags        = (TPMKeyFlags)blob.ReadUInt32();
            _authDataUsage   = (TPMAuthDataUsage)blob.ReadByte();
            _algorithmParams = TPMKeyParamsCore.CreateFromTPMBlob(blob);

            uint pcrInfoSize = blob.ReadUInt32();

            /*byte[] pcrInfo =*/ blob.ReadBytes((int)pcrInfoSize);

            _pubKey = TPMStorePubkeyCore.CreateFromTpmBlob(blob);

            uint encDataSize = blob.ReadUInt32();

            _encData = blob.ReadBytes((int)encDataSize);
        }
Example #3
0
        public void ReadFromTpmBlob(TPMBlob blob)
        {
            _pcrSelection = TPMPCRSelectionCore.CreateFromTPMBlob(blob);

            uint valueSize = blob.ReadUInt32();

            _pcrValues = new byte[valueSize / 20][];

            for (int i = 0; i < valueSize / 20; i++)
            {
                _pcrValues[i] = blob.ReadBytes(20);
            }
        }
Example #4
0
            public void ReadFromTpmBlob(TPMBlob blob)
            {
                /*uint responseSize = */ blob.ReadUInt32();

                this._tag         = blob.ReadUInt16();
                this._version     = new TPMVersionCore(blob);
                this._specLevel   = blob.ReadUInt16();
                this._errataRev   = blob.ReadByte();
                this._tpmVendorId = new byte[4];
                blob.Read(_tpmVendorId, 0, _tpmVendorId.Length);

                ushort vendorSize = blob.ReadUInt16();

                _vendorSpecific = blob.ReadBytes(vendorSize);
            }
Example #5
0
        public override TPMCommandResponse Process()
        {
            TPMBlob requestBlob = new TPMBlob();

            requestBlob.WriteCmdHeader(TPMCmdTags.TPM_TAG_RQU_COMMAND, TPMOrdinals.TPM_ORD_PcrRead);
            requestBlob.WriteUInt32((uint)_register);
            requestBlob.WriteCmdSize();

            TPMBlob    responseBlob  = TransmitMe(requestBlob);
            Parameters responseParam = new Parameters();


            byte[] val = responseBlob.ReadBytes(20);

            responseParam.AddPrimitiveType("pcrnum", _register);
            responseParam.AddPrimitiveType("value", val);


            TPMCommandResponse response = new TPMCommandResponse(true, TPMCommandNames.TPM_CMD_PCRRead, responseParam);

            return(response);
        }
Example #6
0
        public override TPMCommandResponse Process()
        {
            //We don't have any meaningful labeldata we could include,
            //so generate some random
            byte[] labelData = new byte[16];
            Random r         = new Random();

            r.NextBytes(labelData);


            if (_params.IsDefined <ITPMHandle>("handle") == false)
            {
                return(new TPMCommandResponse(false, TPMCommandNames.TPM_CMD_SaveContext, new Parameters()));
            }


            ITPMHandle handle = _params.GetValueOf <ITPMHandle>("handle");

            TPMBlob requestBlob = new TPMBlob();

            requestBlob.WriteCmdHeader(TPMCmdTags.TPM_TAG_RQU_COMMAND, TPMOrdinals.TPM_ORD_SaveContext);
            requestBlob.WriteUInt32(handle.Handle);
            requestBlob.WriteUInt32((uint)handle.ResourceType);
            requestBlob.Write(labelData, 0, labelData.Length);

            TPMBlob responseBlob = TransmitMe(requestBlob);

            responseBlob.SkipHeader();

            uint blobSize = responseBlob.ReadUInt32();

            byte[] contextBlob = responseBlob.ReadBytes((int)blobSize);

            Parameters responseParams = new Parameters();

            responseParams.AddPrimitiveType("context_blob", contextBlob);
            return(new TPMCommandResponse(true, TPMCommandNames.TPM_CMD_SaveContext, responseParams));
        }
Example #7
0
 public void ReadFromTpmBlob(TPMBlob blob)
 {
     _structureTag = (TPMStructureTag)blob.ReadUInt16();
     _label        = blob.ReadBytes(4);
     _counterValue = blob.ReadUInt32();
 }
Example #8
0
        public void ReadFromTpmBlob(TPMBlob blob)
        {
            uint keyLength = blob.ReadUInt32();

            _pubkey = blob.ReadBytes((int)keyLength);
        }