private NvRead ( TpmHandle authHandle, TpmHandle nvIndex, ushort size, ushort offset ) : byte[] | ||
authHandle | TpmHandle | |
nvIndex | TpmHandle | |
size | ushort | |
offset | ushort | |
return | byte[] |
private string GetHeldData() { TpmHandle nvUriHandle = new TpmHandle(AIOTH_PERSISTED_URI_INDEX + logicalDeviceId); Byte[] nvData; string iotHubUri = ""; try { // Open the TPM Tpm2Device tpmDevice = new TbsDevice(); tpmDevice.Connect(); var tpm = new Tpm2(tpmDevice); // Read the URI from the TPM Byte[] name; NvPublic nvPublic = tpm.NvReadPublic(nvUriHandle, out name); nvData = tpm.NvRead(nvUriHandle, nvUriHandle, nvPublic.dataSize, 0); // Dispose of the TPM tpm.Dispose(); } catch { return iotHubUri; } // Convert the data to a srting for output iotHubUri = System.Text.Encoding.UTF8.GetString(nvData); return iotHubUri; }