Data Structures | |
class | atcacert_cert_element_t |
class | atcacert_cert_loc_t |
class | atcacert_cert_sn_src_t |
class | atcacert_cert_type_t |
class | atcacert_comp_data_t |
class | atcacert_date_format_t |
class | atcacert_def_t |
class | atcacert_device_loc_t |
class | atcacert_device_zone_t |
class | atcacert_std_cert_element_t |
class | atcacert_tm_utc_t |
class | atcacert_transform_t |
class | CertStatus |
Functions | |
def | _atcacert_convert_bytes (kwargs, name, pointer) |
def | _atcacert_convert_enum (kwargs, name, enum) |
def | atcacert_max_cert_size (cert_def, max_cert_size) |
def | atcacert_get_response (device_private_key_slot, challenge, response) |
def | atcacert_read_cert (cert_def, ca_public_key, cert, cert_size) |
def | atcacert_write_cert (cert_def, cert, cert_size) |
def | atcacert_create_csr (csr_def, csr, csr_size) |
def | atcacert_create_csr_pem (csr_def, csr, csr_size) |
def | atcacert_date_enc (date_format, timestamp, formatted_date, formatted_date_size) |
def | atcacert_date_dec (date_format, formatted_date, formatted_date_size, timestamp) |
def | atcacert_date_enc_compcert (issue_date, expire_years, enc_dates) |
def | atcacert_date_dec_compcert (enc_dates, expire_date_format, issue_date, expire_date) |
def | atcacert_date_get_max_date (date_format, timestamp) |
ATCACERT: classes and functions for interacting with compressed certificates
|
protected |
Internal Helper Function: Convert python 'bytes' into memory pointer for ctypes structure :param kwargs: kwargs dictionary :param name: _field_ name that will be converted :param pointer: Conversion Class (resulting type - pointer of type x) :return:
|
protected |
Internal Helper Function: Convert python enum into ctypes integer :param kwargs: kwargs dictionary :param name: _field_ name that will be converted :param enum: Conversion Class (resulting type) :return:
def cryptoauthlib.atcacert.atcacert_create_csr | ( | csr_def, | |
csr, | |||
csr_size | |||
) |
Creates a CSR specified by the CSR definition from the ATECC508A device. This process involves reading the dynamic CSR data from the device and combining it with the template found in the CSR definition, then signing it. Return the CSR int der format Args: csr_def CSR definition describing where to find the dynamic CSR information on the device and how to incorporate it into the template. Expects atcacert_def_t. csr Buffer to receive the CSR. Expects bytearray. csr_size As input, the size of the CSR buffer in bytes. As output, the size of the CSR as PEM returned in cert in bytes. Expects AtcaReference. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_create_csr_pem | ( | csr_def, | |
csr, | |||
csr_size | |||
) |
Creates a CSR specified by the CSR definition from the ATECC508A device. This process involves reading the dynamic CSR data from the device and combining it with the template found in the CSR definition, then signing it. Return the CSR int der format Args: csr_def CSR definition describing where to find the dynamic CSR information on the device and how to incorporate it into the template. Expects atcacert_def_t. csr Buffer to receive the CSR. Expects bytearray. csr_size As input, the size of the CSR buffer in bytes. As output, the size of the CSR as PEM returned in cert in bytes. Expects AtcaReference. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_date_dec | ( | date_format, | |
formatted_date, | |||
formatted_date_size, | |||
timestamp | |||
) |
Parse a formatted timestamp according to the specified format. Args: date_format Format to parse the formatted date as. formatted_date Formatted date to be parsed. formatted_date_size Size of the formatted date in bytes. timestamp Parsed timestamp is returned here. Expects atcacert_tm_utc_t. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_date_dec_compcert | ( | enc_dates, | |
expire_date_format, | |||
issue_date, | |||
expire_date | |||
) |
Decode the issue and expire dates from the format used by the compressed certificate. Args: enc_dates Encoded date from the compressed certificate. 3 bytes. expire_date_format Expire date format. Only used to determine max date when no expiration date is specified by the encoded date. issue_date Decoded issue date is returned here. Expects atcacert_tm_utc_t. expire_date Decoded expire date is returned here. If there is no expiration date, the expire date will be set to a maximum value for the given expire_date_format. Expects atcacert_tm_utc_t. Returns: ATCACERT_E_SUCCESS on success
def cryptoauthlib.atcacert.atcacert_date_enc | ( | date_format, | |
timestamp, | |||
formatted_date, | |||
formatted_date_size | |||
) |
Format a timestamp according to the format type. Args: date_format Format to use. timestamp Timestamp to format. Expects atcacert_tm_utc_t. formatted_date Formatted date will be returned in this buffer. Expects bytearray. formatted_date_size As input, the size of the formatted_date buffer. As output, the size of the returned formatted_date. Expects AtcaReference. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_date_enc_compcert | ( | issue_date, | |
expire_years, | |||
enc_dates | |||
) |
Encode the issue and expire dates in the format used by the compressed certificate. Args: issue_date Issue date to encode. Note that minutes and seconds will be ignored. Expects atcacert_tm_utc_t. expire_years Expire date is expressed as a number of years past the issue date. 0 should be used if there is no expire date. enc_dates Encoded dates for use in the compressed certificate is returned here. 3 bytes. Expects bytearray. Returns: ATCACERT_E_SUCCESS on success
def cryptoauthlib.atcacert.atcacert_date_get_max_date | ( | date_format, | |
timestamp | |||
) |
Return the maximum date available for the given format. Args: format Format to get the max date for. timestamp Max date is returned here. Expects atcacert_tm_utc_t. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_get_response | ( | device_private_key_slot, | |
challenge, | |||
response | |||
) |
Calculates the response to a challenge sent from the host. The challenge-response protocol is an ECDSA Sign and Verify. This performs the ECDSA Sign on the challenge and returns the signature as the response. Args: device_private_key_slot Slot number for the device's private key. This must be the same slot used to generate the public key included in the device's certificate. challenge Challenge to generate the response for. Must be 32 bytes. response Response will be returned in this buffer. 64 bytes. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_max_cert_size | ( | cert_def, | |
max_cert_size | |||
) |
Return the maximum possible certificate size in bytes for a given cert def. Certificate can be variable size, so this gives an appropriate buffer size when reading the certificates. Args: cert_def Certificate definition to find a max size for. Expects atcacert_def_t. max_cert_size Maximum certificate size will be returned here in bytes. Expects AtcaReference. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_read_cert | ( | cert_def, | |
ca_public_key, | |||
cert, | |||
cert_size | |||
) |
Reads the certificate specified by the certificate definition from the ATECC508A device. This process involves reading the dynamic cert data from the device and combining it with the template found in the certificate definition. Args: cert_def Certificate definition describing where to find the dynamic certificate information on the device and how to incorporate it into the template. Expects atcacert_def_t. ca_public_key The ECC P256 public key of the certificate authority that signed this certificate. Formatted as the 32 byte X and Y integers concatenated together (64 bytes total). Set to NULL if the authority key id is not needed, set properly in the cert_def template, or stored on the device as specifed in the cert_def cert_elements. cert Buffer to received the certificate. Expects bytearray. cert_size As input, the size of the cert buffer in bytes. As output, the size of the certificate returned in cert in bytes. Expects AtcaReference. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.
def cryptoauthlib.atcacert.atcacert_write_cert | ( | cert_def, | |
cert, | |||
cert_size | |||
) |
Take a full certificate and write it to the ATECC508A device according to the certificate definition. Args: cert_def Certificate definition describing where the dynamic certificate information is and how to store it on the device. Expects atcacert_def_t. cert Full certificate to be stored. cert_size Size of the full certificate in bytes. Returns: ATCACERT_E_SUCCESS on success, otherwise an error code.