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