1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
12 @file der_length_utctime.c
13 ASN.1 DER, get length of GeneralizedTime, Steffen Jaeckel
14 Based on der_length_utctime.c
20 Gets length of DER encoding of GeneralizedTime
21 @param gtime The GeneralizedTime structure to get the size of
22 @param outlen [out] The length of the DER encoding
23 @return CRYPT_OK if successful
25 int der_length_generalizedtime(ltc_generalizedtime *gtime, unsigned long *outlen)
27 LTC_ARGCHK(outlen != NULL);
28 LTC_ARGCHK(gtime != NULL);
31 /* we encode as YYYYMMDDhhmmssZ */
34 unsigned long len = 2 + 14 + 1;
35 unsigned fs = gtime->fs;
40 if (gtime->off_hh == 0 && gtime->off_mm == 0) {
41 /* we encode as YYYYMMDDhhmmss.fsZ */
45 /* we encode as YYYYMMDDhhmmss.fs{+|-}hh'mm' */
56 /* ref: $Format:%D$ */
57 /* git commit: $Format:%H$ */
58 /* commit time: $Format:%ai$ */