1 (edited by bstraehl 2021-01-13 10:14:06)

Topic: Visibility of asn.c: GetTimeString

After a PKCS#7 CMS verification I want to read out the signing date/time from the signature. I do this as follows:

  byte buffer[1024];      
  const byte signingTimeOid[] =
          { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x05 };
  word32 bufferSize = sizeof(buffer);
  result = wc_PKCS7_GetAttributeValue(&pkcs7, signingTimeOid, sizeof(signingTimeOid), buffer, &bufferSize);
  printf("signing time result=%d\n", result);
  if (result>0) {
    char resultingDateTime[100];
    result = GetTimeString(buffer,ASN_UTC_TIME,resultingDateTime,sizeof(resultingDateTime));
    if (result) {
      printf("signing time is %s\n", resultingDateTime);
    } else {
      printf("signing time conversion failed (not UTC format?)\n");
    }
  } else {
    printf("failed to read signing time\n");
  }

While I'm allowed to use public function wc_PKCS7_GetAttributeValue, I'm not allowed to convert the result to a human readable format with GetTimeString, because latter is not for public use. So I'm forced to implement such a formatter by myself. Why's this?

Best regards,
Beat Straehl

Share

2 (edited by tmael 2021-01-14 17:34:03)

Re: Visibility of asn.c: GetTimeString

Hi bstraehl,

Thanks for contacting wolfSSL!

This sounds like a reasonable request to add a function that can convert time to a human-readable format.

We are tracking this request internally.

If there is a timeline associated with this please let me know so we can try to expedite the request.

Thanks,
Tesfa

Share

Re: Visibility of asn.c: GetTimeString

Hello Tesfa
Yes, I also think it makes sense. And regarding the internal request, don't hurry. For the time being, I can easily live with a copy-and-pasted version of GetTimeString, if necessary.
Thank you.
BR,
Beat

Share