ATECC508A.Validity (atecc508a v0.3.0) View Source

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

Specs

Convenience function for compressing issue date/expiration tuples

Link to this function

compress(issue_date, expire_date)

View Source

Specs

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

Specs

create_compatible_validity(non_neg_integer()) :: {DateTime.t(), DateTime.t()}

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

Specs

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.