View Source ATECC508A.Validity (atecc508a v1.2.0)

Handle the ATECC508's encoded dates

Link to this section Summary

Functions

Convenience function for compressing issue date/expiration tuples

Compress an issue date/expiration to a bitstring

Create a compatible date range for X.509 certificates that need to be compressed.

Decompress an issue date/expiration bitstring

Check that the specified dates can be represented in a compressed certificate.

Link to this section Functions

@spec compress({DateTime.t(), DateTime.t()}) :: ATECC508A.encoded_dates()

Convenience function for compressing issue date/expiration tuples

Link to this function

compress(issue_date, expire_date)

View Source
@spec compress(DateTime.t(), DateTime.t()) :: ATECC508A.encoded_dates()

Compress an issue date/expiration to a bitstring

This function can easily lose precision on the dates and times since so little is encoded. If accepting arbitrary datetimes, you'll want to check that the conversion didn't truncate in strange ways.

Important: the max issue year is 2031!!

Link to this function

create_compatible_validity(years)

View Source
@spec create_compatible_validity(non_neg_integer()) :: {DateTime.t(), DateTime.t()}

Create a compatible date range for X.509 certificates that need to be compressed.

@spec decompress(ATECC508A.encoded_dates()) :: {DateTime.t(), DateTime.t()}

Decompress an issue date/expiration bitstring

Link to this function

valid_dates?(issue_date, expire_date)

View Source

Check that the specified dates can be represented in a compressed certificate.