28 #ifndef ATCACERT_DATE_H 29 #define ATCACERT_DATE_H 74 #define DATEFMT_ISO8601_SEP_SIZE (20) 75 #define DATEFMT_RFC5280_UTC_SIZE (13) 76 #define DATEFMT_POSIX_UINT32_BE_SIZE (4) 77 #define DATEFMT_POSIX_UINT32_LE_SIZE (4) 78 #define DATEFMT_RFC5280_GEN_SIZE (15) 79 #define DATEFMT_MAX_SIZE DATEFMT_ISO8601_SEP_SIZE 80 #define ATCACERT_DATE_FORMAT_SIZES_COUNT 5 97 uint8_t* formatted_date,
98 size_t* formatted_date_size);
111 const uint8_t* formatted_date,
112 size_t formatted_date_size,
127 uint8_t expire_years,
128 uint8_t enc_dates[3]);
RFC 5280 (X.509) 4.1.2.5.2 GeneralizedTime format YYYYMMDDhhmmssZ.
Definition: atcacert_date.h:71
int atcacert_date_enc_rfc5280_gen(const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_RFC5280_GEN_SIZE])
Definition: atcacert_date.c:537
ISO8601 full date YYYY-MM-DDThh:mm:ssZ.
Definition: atcacert_date.h:67
atcacert_date_format_e
Definition: atcacert_date.h:65
int tm_sec
Definition: atcacert_date.h:54
int atcacert_date_get_max_date(atcacert_date_format_t format, atcacert_tm_utc_t *timestamp)
Return the maximum date available for the given format.
Definition: atcacert_date.c:102
int atcacert_date_enc_rfc5280_utc(const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_RFC5280_UTC_SIZE])
Definition: atcacert_date.c:402
int atcacert_date_dec_compcert(const uint8_t enc_dates[3], atcacert_date_format_t expire_date_format, atcacert_tm_utc_t *issue_date, atcacert_tm_utc_t *expire_date)
Decode the issue and expire dates from the format used by the compressed certificate.
Definition: atcacert_date.c:1047
int atcacert_date_enc_posix_uint32_be(const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_POSIX_UINT32_BE_SIZE])
Definition: atcacert_date.c:873
#define DATEFMT_POSIX_UINT32_LE_SIZE
Definition: atcacert_date.h:77
int tm_hour
Definition: atcacert_date.h:56
const size_t ATCACERT_DATE_FORMAT_SIZES[ATCACERT_DATE_FORMAT_SIZES_COUNT]
Definition: atcacert_date.c:32
RFC 5280 (X.509) 4.1.2.5.1 UTCTime format YYMMDDhhmmssZ.
Definition: atcacert_date.h:68
int tm_year
Definition: atcacert_date.h:59
#define DATEFMT_POSIX_UINT32_BE_SIZE
Definition: atcacert_date.h:76
#define DATEFMT_RFC5280_GEN_SIZE
Definition: atcacert_date.h:78
int tm_mday
Definition: atcacert_date.h:57
#define DATEFMT_RFC5280_UTC_SIZE
Definition: atcacert_date.h:75
POSIX (aka UNIX) date format. Seconds since Jan 1, 1970. 32 bit unsigned integer, little endian...
Definition: atcacert_date.h:70
#define ATCACERT_DATE_FORMAT_SIZES_COUNT
Definition: atcacert_date.h:80
int atcacert_date_dec_posix_uint32_le(const uint8_t formatted_date[DATEFMT_POSIX_UINT32_LE_SIZE], atcacert_tm_utc_t *timestamp)
Definition: atcacert_date.c:972
int atcacert_date_dec_rfc5280_utc(const uint8_t formatted_date[DATEFMT_RFC5280_UTC_SIZE], atcacert_tm_utc_t *timestamp)
Definition: atcacert_date.c:464
Definition: atcacert_date.h:52
enum atcacert_date_format_e atcacert_date_format_t
int atcacert_date_enc_iso8601_sep(const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_ISO8601_SEP_SIZE])
Definition: atcacert_date.c:248
int atcacert_date_enc(atcacert_date_format_t format, const atcacert_tm_utc_t *timestamp, uint8_t *formatted_date, size_t *formatted_date_size)
Format a timestamp according to the format type.
Definition: atcacert_date.c:40
int atcacert_date_enc_compcert(const atcacert_tm_utc_t *issue_date, uint8_t expire_years, uint8_t enc_dates[3])
Encode the issue and expire dates in the format used by the compressed certificate.
Definition: atcacert_date.c:991
int tm_mon
Definition: atcacert_date.h:58
int tm_min
Definition: atcacert_date.h:55
POSIX (aka UNIX) date format. Seconds since Jan 1, 1970. 32 bit unsigned integer, big endian...
Definition: atcacert_date.h:69
int atcacert_date_dec_iso8601_sep(const uint8_t formatted_date[DATEFMT_ISO8601_SEP_SIZE], atcacert_tm_utc_t *timestamp)
Definition: atcacert_date.c:312
Declarations common to all atcacert code.
int atcacert_date_enc_posix_uint32_le(const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_POSIX_UINT32_LE_SIZE])
Definition: atcacert_date.c:947
int atcacert_date_dec_posix_uint32_be(const uint8_t formatted_date[DATEFMT_POSIX_UINT32_BE_SIZE], atcacert_tm_utc_t *timestamp)
Definition: atcacert_date.c:928
int atcacert_date_dec_rfc5280_gen(const uint8_t formatted_date[DATEFMT_RFC5280_GEN_SIZE], atcacert_tm_utc_t *timestamp)
Definition: atcacert_date.c:591
struct atcacert_tm_utc_s atcacert_tm_utc_t
int atcacert_date_dec(atcacert_date_format_t format, const uint8_t *formatted_date, size_t formatted_date_size, atcacert_tm_utc_t *timestamp)
Parse a formatted timestamp according to the specified format.
Definition: atcacert_date.c:74
#define DATEFMT_ISO8601_SEP_SIZE
Definition: atcacert_date.h:74