ATECC508A.Validity (atecc508a v1.4.0)

Copy Markdown View Source

Handle the ATECC508's encoded dates

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.

Functions

compress(arg)

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

Convenience function for compressing issue date/expiration tuples

compress(issue_date, expire_date)

@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!!

create_compatible_validity(years)

@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.

decompress(arg)

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

Decompress an issue date/expiration bitstring

valid_dates?(issue_date, expire_date)

@spec valid_dates?(DateTime.t(), DateTime.t()) :: boolean()

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