CryptoAuthLib
Microchip CryptoAuthentication Library
atcacert_date.h File Reference

Declarations for date handling with regard to certificates. More...

#include <stddef.h>
#include "atcacert.h"

Go to the source code of this file.

Data Structures

struct  atcacert_tm_utc_s
 

Macros

#define DATEFMT_ISO8601_SEP_SIZE   (20)
 
#define DATEFMT_RFC5280_UTC_SIZE   (13)
 
#define DATEFMT_POSIX_UINT32_BE_SIZE   (4)
 
#define DATEFMT_POSIX_UINT32_LE_SIZE   (4)
 
#define DATEFMT_RFC5280_GEN_SIZE   (15)
 
#define DATEFMT_MAX_SIZE   DATEFMT_ISO8601_SEP_SIZE
 
#define ATCACERT_DATE_FORMAT_SIZES_COUNT   5
 

Typedefs

typedef struct atcacert_tm_utc_s atcacert_tm_utc_t
 
typedef enum atcacert_date_format_e atcacert_date_format_t
 

Enumerations

enum  atcacert_date_format_e {
  DATEFMT_ISO8601_SEP, DATEFMT_RFC5280_UTC, DATEFMT_POSIX_UINT32_BE, DATEFMT_POSIX_UINT32_LE,
  DATEFMT_RFC5280_GEN
}
 

Functions

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int atcacert_date_enc_iso8601_sep (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_ISO8601_SEP_SIZE])
 
int atcacert_date_dec_iso8601_sep (const uint8_t formatted_date[DATEFMT_ISO8601_SEP_SIZE], atcacert_tm_utc_t *timestamp)
 
int atcacert_date_enc_rfc5280_utc (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_RFC5280_UTC_SIZE])
 
int atcacert_date_dec_rfc5280_utc (const uint8_t formatted_date[DATEFMT_RFC5280_UTC_SIZE], atcacert_tm_utc_t *timestamp)
 
int atcacert_date_enc_rfc5280_gen (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_RFC5280_GEN_SIZE])
 
int atcacert_date_dec_rfc5280_gen (const uint8_t formatted_date[DATEFMT_RFC5280_GEN_SIZE], atcacert_tm_utc_t *timestamp)
 
int atcacert_date_enc_posix_uint32_be (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_POSIX_UINT32_BE_SIZE])
 
int atcacert_date_dec_posix_uint32_be (const uint8_t formatted_date[DATEFMT_POSIX_UINT32_BE_SIZE], atcacert_tm_utc_t *timestamp)
 
int atcacert_date_enc_posix_uint32_le (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[DATEFMT_POSIX_UINT32_LE_SIZE])
 
int atcacert_date_dec_posix_uint32_le (const uint8_t formatted_date[DATEFMT_POSIX_UINT32_LE_SIZE], atcacert_tm_utc_t *timestamp)
 

Variables

const size_t ATCACERT_DATE_FORMAT_SIZES [ATCACERT_DATE_FORMAT_SIZES_COUNT]
 

Detailed Description

Declarations for date handling with regard to certificates.