Discussion:
[TrouSerS-users] Problem verifying signature (no memory)
eye two are
2015-09-18 05:28:27 UTC
Permalink
I am trying to create a public key object to verify my signature.

result=Tspi_Hash_VerifySignature(hHashToSign,*hVerify_Key*,256,&Signature);
DBG("Verify", result);

This is my code:

//Reading the signature's public key

fin=fopen("signingkey.pub","rb");
fseek(fin, 0, SEEK_END);
pubSignKeyLength=ftell(fin);
fseek(fin, 0, SEEK_SET);

printf("Public Key Length: %d\n", pubSignKeyLength);

if(fin != NULL)
{
read(fileno(fin),&pubVerifyKey,pubSignKeyLength);
fclose(fin);
}
else
{
printf("ERROR opening public key file for reading\r\n");
}

//Creating a Verify Key

initFlags = TSS_KEY_TYPE_SIGNING |
TSS_KEY_SIZE_2048 |
TSS_KEY_NO_AUTHORIZATION |
TSS_KEY_NOT_MIGRATABLE;

*result=Tspi_Context_CreateObject(hContext,TSS_OBJECT_TYPE_RSAKEY,initFlags,&hVerify_Key);*
DBG("Tspi_Context_CreateObject Verify_Key",result);

*result=Tspi_SetAttribData(hVerify_Key,TSS_TSPATTRIB_KEY_BLOB,TSS_TSPATTRIB_KEYBLOB_PUBLIC_KEY,pubSignKeyLength,&pubVerifyKey);*
DBG("SetPubKey in Verify Key", result);

This is the error I receive:

Public Key Length: 284
Line 104, main) Tspi_Context_CreateObject Verify_Key returned 0x00000000.
Success.
*Line 107, main) SetPubKey in Verify Key returned 0x00003005. Out of
memory.*

What does it mean by out of memory? Is it a problem with the parameters of
the function? What am I doing wrong?

Loading...