CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
atcacert_date.h File Reference

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

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

Data Structures

struct  atcacert_tm_utc_s
 

Macros

#define DATEFMT_ISO8601_SEP   (0U)
 ISO8601 full date YYYY-MM-DDThh:mm:ssZ.
 
#define DATEFMT_RFC5280_UTC   (1U)
 RFC 5280 (X.509) 4.1.2.5.1 UTCTime format YYMMDDhhmmssZ.
 
#define DATEFMT_POSIX_UINT32_BE   (2U)
 POSIX (aka UNIX) date format. Seconds since Jan 1, 1970. 32 bit unsigned integer, big endian.
 
#define DATEFMT_POSIX_UINT32_LE   (3U)
 POSIX (aka UNIX) date format. Seconds since Jan 1, 1970. 32 bit unsigned integer, little endian.
 
#define DATEFMT_RFC5280_GEN   (4U)
 RFC 5280 (X.509) 4.1.2.5.2 GeneralizedTime format YYYYMMDDhhmmssZ.
 
#define DATEFMT_INVALID   (0xFFU)
 
#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
 
#define ATCACERT_COMP_CERT_MAX_SIZE   72u
 
#define atcacert_date_enc_posix_uint32_be   atcacert_date_enc_posix_be
 
#define atcacert_date_dec_posix_uint32_be   atcacert_date_dec_posix_be
 
#define atcacert_date_enc_posix_uint32_le   atcacert_date_enc_posix_le
 
#define atcacert_date_dec_posix_uint32_le   atcacert_date_dec_posix_le
 

Typedefs

typedef struct atcacert_tm_utc_s atcacert_tm_utc_t
 
typedef uint8_t atcacert_date_format_t
 

Functions

ATCA_STATUS 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.
 
ATCA_STATUS 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.
 
ATCA_STATUS 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.
 
ATCA_STATUS atcacert_date_enc_compcert_ext (const atcacert_tm_utc_t *issue_date, uint8_t expire_years, uint8_t comp_cert[72u])
 Encode the issue and expire dates in the format used by the compressed certificate.
 
ATCA_STATUS 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.
 
ATCA_STATUS atcacert_date_dec_compcert_ext (const uint8_t comp_cert[72u], 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.
 
atcacert_date_format_t atcacert_date_from_asn1_tag (const uint8_t tag)
 Convert the asn1 tag for the supported time formats into the local time format.
 
ATCA_STATUS atcacert_date_get_max_date (atcacert_date_format_t format, atcacert_tm_utc_t *timestamp)
 Return the maximum date available for the given format.
 
ATCA_STATUS atcacert_date_enc_iso8601_sep (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[(20)])
 
ATCA_STATUS atcacert_date_dec_iso8601_sep (const uint8_t formatted_date[(20)], atcacert_tm_utc_t *timestamp)
 
ATCA_STATUS atcacert_date_enc_rfc5280_utc (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[(13)])
 
ATCA_STATUS atcacert_date_dec_rfc5280_utc (const uint8_t formatted_date[(13)], atcacert_tm_utc_t *timestamp)
 
ATCA_STATUS atcacert_date_enc_rfc5280_gen (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[(15)])
 
ATCA_STATUS atcacert_date_dec_rfc5280_gen (const uint8_t formatted_date[(15)], atcacert_tm_utc_t *timestamp)
 
ATCA_STATUS atcacert_date_enc_posix_be (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[(4)])
 
ATCA_STATUS atcacert_date_dec_posix_be (const uint8_t formatted_date[(4)], atcacert_tm_utc_t *timestamp)
 
ATCA_STATUS atcacert_date_enc_posix_le (const atcacert_tm_utc_t *timestamp, uint8_t formatted_date[(4)])
 
ATCA_STATUS atcacert_date_dec_posix_le (const uint8_t formatted_date[(4)], atcacert_tm_utc_t *timestamp)
 
int atcacert_date_cmp (const atcacert_tm_utc_t *timestamp1, const atcacert_tm_utc_t *timestamp2)
 Compare two dates.
 

Variables

const size_t ATCACERT_DATE_FORMAT_SIZES [5]
 

Detailed Description

Declarations for date handling with regard to certificates.