Hi Debbie,

I should have emailed in again as I have managed to get around this issue.
It seems like it was being caused indirectly by me not properly set up the
owner key.

Sorry for not stating as much.

Would you be willing to help me with a different issue I've run into while
trying use unseal?
If you wouldn't mind I can post the code as well as the different outputs
I've been getting from it?

On Thu, 23 Jan 2020 at 10:16, Debora Velarde Babb <[email protected]>
wrote:

> On Sat, 2020-01-04 at 10:03 +0000, Sam Jenkins via TrouSerS-users
> wrote:
> > Hi there,
> > I've been trying to setup a short program to seal and unseal a file
> > using the TSPI library, and seem to have run into a wall, when I try
> > to load the key in by uuid I keep getting an error of 12556, which
> > from what I've looked up, is TSS_E_INVALID_OBJECT_INITFLAG But I
> > havn't been able to fix it by changing round the object flags etc.
> > I'll post my code below up to the point where the error's occuring,
> > any help would be much appreciated.
>
> Hi Sam,
>
> Are you able to also please share the output as well?
>
> Thanks,
> Debbie
>
> >
> > int main(int argc, const char argv[]) {
> >   TSS_HCONTEXT hContext;
> >   TSS_RESULT result;
> >   TSS_HTPM hTPM = 0;
> >   TSS_UUID thisID = {9};
> >   TSS_HKEY hKey, hSRK;
> >   TSS_UUID SRK_UUID = TSS_UUID_SRK;
> >   UINT32 pcrs[8] = {0, 1, 2, 3, 4, 5, 6, 7};
> >   Tspi_Context_Create(&hContext);
> >   /* Connect to the local TCS provider */
> >   Tspi_Context_Connect(hContext, NULL);
> >   Tspi_Context_GetTpmObject(hContext, &hTPM);
> >   keySetup(&hContext);
> >   printf(
> >       "%u is load error\n",
> >       Tspi_Context_LoadKeyByUUID(hContext, TSS_PS_TYPE_SYSTEM,
> > thisID,  &hKey));
> >   sealFile(&hContext, &hTPM, "test.txt", hKey, pcrs, 8);
> >   unsealFile(&hContext, "test.txt", hKey);
> >   Tspi_Context_FreeMemory(hContext, NULL);
> >   result = Tspi_Context_Close(hContext);
> >   if (result == TSS_SUCCESS) {
> >     printf("succesfully close context\n");
> >   } else {
> >     return 0;
> >   }
> >   return 0;
> > }
> >
> >
> > int keySetup(TSS_HCONTEXT *hContext) {
> >
> >   TSS_UUID SRK_UUID = TSS_UUID_SRK;
> >   TSS_UUID thisID = {9};
> >   TSS_FLAG initFlags;
> >   TSS_HKEY hSRK, hKey, temp;
> >   TSS_HPOLICY hPolicy;
> >   initFlags = TSS_KEY_TYPE_STORAGE | TSS_KEY_SIZE_2048 |
> >               TSS_KEY_NO_AUTHORIZATION | TSS_KEY_NOT_MIGRATABLE;
> >
> >   /* Load the new key’s parent key, the Storage Root Key */
> >   Tspi_Context_LoadKeyByUUID(*hContext, TSS_PS_TYPE_SYSTEM, SRK_UUID,
> > &hSRK);
> >   /* Create the software key object */
> >   Tspi_Context_CreateObject(*hContext, TSS_OBJECT_TYPE_RSAKEY,
> > initFlags,
> >                             &hKey);
> >   Tspi_Key_CreateKey(hKey, hSRK, 0);
> >   Tspi_Context_UnregisterKey(*hContext, TSS_PS_TYPE_SYSTEM, thisID,
> > &temp);
> >   printf("%u is register error\n",
> >          Tspi_Context_RegisterKey(*hContext, hKey,
> > TSS_PS_TYPE_SYSTEM, thisID,
> >                                   TSS_PS_TYPE_SYSTEM, SRK_UUID));
> >   return 0;
> > }
> > _______________________________________________
> > TrouSerS-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/trousers-users
>
>
>

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

Reply via email to