Hi all,
I create a key, register it into the User PS and load it into the TPM.
Then I call Tspi_Context_GetRegisteredKeysByUUID2().

The printing of the "ppKeyHierarchy" param contents shows those key are 
not loaded though.
Is this a bug?

Thank you.

Code in summary:

TSS_FLAG initFlags = TSS_KEY_SIZE_2048 | TSS_KEY_TYPE_BIND | 
TSS_KEY_NO_AUTHORIZATION;
Tspi_Context_CreateObject(hContext, TSS_OBJECT_TYPE_RSAKEY, initFlags, 
&hKey);
Tspi_Key_CreateKey(hKey, hSRK, 0);
TSS_UUID MY_UUID = {0, 0, 0, 0, 0, {0, 0, 0, 0, 22, 33}};
Tspi_Context_RegisterKey(hContext, hKey_1, TSS_PS_TYPE_USER, MY_UUID, 
TSS_PS_TYPE_SYSTEM, SRK_UUID);
Tspi_Context_LoadKeyByUUID(hContext, TSS_PS_TYPE_USER, MY_UUID, &hKey);

TSS_KM_KEYINFO2 *info;
result=Tspi_Context_GetRegisteredKeysByUUID2(hContext, TSS_PS_TYPE_USER, 
NULL, &infoLen, &info);

printf("\nRegistered Keys array (infoLen: %d): \n", infoLen);
   for(int i=0; i <= infoLen; i++)
   {
     printf("info[%d]:\n", i);
     printf("versionInfo (bMinor,bMajor - bRevMinor,bRevMajor):
       %d,%d - %d,%d \n",
       info[i].versionInfo.bMinor,
       info[i].versionInfo.bMajor,
       info[i].versionInfo.bRevMinor,
       info[i].versionInfo.bRevMajor);
     printf("bAuthDataUsage:\t\t\t %d (%s) \n",
       info[i].bAuthDataUsage,
       auth_data_usage(info[i].bAuthDataUsage));
     printf("persistentStorageType:\t\t %d (%s) \n",
       info[i].persistentStorageType,
       ps_type(info[i].persistentStorageType));
     printf("fIsLoaded:\t\t\t %d (%s) \n",
       info[i].fIsLoaded,
       loaded_into_TPM(info[i].fIsLoaded));
     printf("ulVendorDataLength: %d \n",
       info[i].ulVendorDataLength);
     printf("keyUUID.rgbNode[]:\t");
     int n2 = sizeof(info[i].keyUUID.rgbNode) /
       sizeof(info[i].keyUUID.rgbNode[0]); // 6
    for(int j=0; j < n2; j++)
       printf("%3d ", info[i].keyUUID.rgbNode[j]);
    printf("\n");
    printf("persistentStorageTypeParent:\t %d (%s) \n",
       info[i].persistentStorageTypeParent,
       ps_type(info[i].persistentStorageTypeParent));
    printf("parentKeyUUID.rgbNode[]:");
    int n3 = sizeof(info[i].parentKeyUUID.rgbNode) /
       sizeof(info[i].parentKeyUUID.rgbNode[0]); // 6
    for(int j=0; j < n3; j++)
       printf("%3d ", info[i].parentKeyUUID.rgbNode[j]);
    printf("\n\n");
  }

Output:

Registered Keys array (infoLen: 2):
info[0]:
versionInfo (bMinor,bMajor - bRevMinor,bRevMajor): 1,1 - 0,0
bAuthDataUsage:                 0 (NO AUTH.)
persistentStorageType:          1 (USER)
fIsLoaded:                      0 (FALSE)
ulVendorDataLength: 0
keyUUID.rgbNode[]:        0   0   0   0  22  33
persistentStorageTypeParent:    2 (SYSTEM)
parentKeyUUID.rgbNode[]:  0   0   0   0   0   1

info[1]:
versionInfo (bMinor,bMajor - bRevMinor,bRevMajor): 1,1 - 0,0
bAuthDataUsage:                 1 (AUTH.)
persistentStorageType:          2 (SYSTEM)
fIsLoaded:                      1 (TRUE)
ulVendorDataLength: 0
keyUUID.rgbNode[]:        0   0   0   0   0   1
persistentStorageTypeParent:    2 (SYSTEM)
parentKeyUUID.rgbNode[]:  0   0   0   0   0   0



------------------------------------------------------------------------------
_______________________________________________
TrouSerS-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-users

Reply via email to