#include <TestCryptoApi.h>
#include <pthread.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
#include<stdbool.h>
#include <SecCryptoMgrCommon.h>
#include <TestCryptoParse.h>
#include <Log.h>
#include <SecryptoIntf.h>
#if defined(DLT_ENABLED)
#include <dlt/dlt.h>
#endif
#define TEST_CRYPTO_VERSION "211205A"
#define CMD_USAGE 2
#define scanStart(scan)        ((scan)->scanTos = -1)
#define scanUngetc(scan)       ((scan)->scanPtr[(scan)->scanTos]--)

#include<unistd.h>
#define max_str_len 100
#define max_char_size 64
char strkey[max_str_len];
int str_key_len;
char charkey[max_char_size];

int32_t testSecGetDataSize(SECCRYPT_HANDLE handle,char* charkey);

int32_t main(int32_t argc, const char* argv[])
{
   char clientName[64] = "seccryptoclient";
   SECCRYPT_HANDLE handle = NULL;
   int32_t retStatus = SECCRYPTO_OK;

   handle = secCryptoInitClntSrvc(clientName);
   
   if (argv[1] == NULL)
   {
      printf("\n------------------ Help Command :-----------------------\n");
      printf("example:- ~$ ./Secryptokeyverify keyfile.txt\n");
      printf("\n--------------------------------------------------------\n");
   }
   
   FILE *keyfile = fopen(argv[1], "r");
   
    if (keyfile == NULL) {
        printf("Error: file is not found or keys are not present in the file.\n");
        exit(1);
    }
    
   while (fgets(strkey, max_str_len, keyfile))
    {
        str_key_len=strlen(strkey);
        strncpy(charkey, strkey, str_key_len-1);
        retStatus = testSecGetDataSize(handle,charkey);
    }
   
   fclose(keyfile);
   secCryptoCtrlCloseDiagSrvc(handle);
   return retStatus;
}

int32_t testSecGetDataSize(SECCRYPT_HANDLE handle,char* charkey)
{
    size_t getDataSize = 0;
    tErrorStatus retStatus = SECCRYPTO_OK;
    
    retStatus = seccryptoGetDataSz(handle,charkey,&getDataSize);
    if (SECCRYPTO_OK == retStatus)
    {
       printf("[%s] : Yes DataSize : [%ld] retStatus : [%d] \n",charkey,getDataSize,retStatus);
    }
    else
    {
       printf("[%s] : No \n",charkey);
    }
    return EXIT_SUCCESS;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: