CryptoAuthLib v3.7.8
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
TNG API (tng_)

These methods provide some convenience functions (mostly around certificates) for TNG devices, which currently include ATECC608A-MAHTN-T. More...

TNG Functions

This folder has a number of convenience functions for working with TNG devices (currently ATECC608A-MAHTN-T).These devices have standard certificates that can be easily read using the functions in tng_atcacert_client.h

Functions

const atcacert_def_ttng_map_get_device_cert_def (int index)
 Helper function to iterate through all trust cert definitions.
 
ATCA_STATUS tng_get_device_cert_def (const atcacert_def_t **cert_def)
 Get the TNG device certificate definition.
 
ATCA_STATUS tng_get_device_cert_def_ext (ATCADevice device, const atcacert_def_t **cert_def)
 Get the TNG device certificate definition.
 
ATCA_STATUS tng_get_device_pubkey (uint8_t *public_key)
 Uses GenKey command to calculate the public key from the primary device public key.
 
const uint8_t g_tflxtls_cert_template_4_device [500]
 
const atcacert_def_t g_tflxtls_cert_def_4_device
 
const atcacert_cert_element_t g_tflxtls_cert_elements_4_device []
 
ATCA_DLL const atcacert_def_t g_tnglora_cert_def_1_signer
 
ATCA_DLL const atcacert_def_t g_tnglora_cert_def_2_device
 
const uint8_t g_cryptoauth_root_ca_002_cert []
 
const size_t g_cryptoauth_root_ca_002_cert_size
 
#define CRYPTOAUTH_ROOT_CA_002_PUBLIC_KEY_OFFSET   266
 
ATCA_DLL const atcacert_def_t g_tnglora_cert_def_4_device
 
SHARED_LIB_EXPORT const uint8_t g_tnglora_cert_template_4_device []
 
SHARED_LIB_EXPORT const atcacert_cert_element_t g_tnglora_cert_elements_4_device []
 
#define TNGLORA_CERT_TEMPLATE_4_DEVICE_SIZE   552
 
ATCA_DLL const atcacert_def_t g_tngtls_cert_def_1_signer
 
SHARED_LIB_EXPORT const uint8_t g_tngtls_cert_template_1_signer []
 
SHARED_LIB_EXPORT const atcacert_cert_element_t g_tngtls_cert_elements_1_signer []
 
#define TNGTLS_CERT_TEMPLATE_1_SIGNER_SIZE   520
 
ATCA_DLL const atcacert_def_t g_tngtls_cert_def_2_device
 
SHARED_LIB_EXPORT const uint8_t g_tngtls_cert_template_2_device []
 
SHARED_LIB_EXPORT const atcacert_cert_element_t g_tngtls_cert_elements_2_device []
 
#define TNGTLS_CERT_TEMPLATE_2_DEVICE_SIZE   505
 
#define TNGTLS_CERT_ELEMENTS_2_DEVICE_COUNT   2
 
ATCA_DLL const atcacert_def_t g_tngtls_cert_def_3_device
 
ATCA_DLL const uint8_t g_tngtls_cert_template_3_device []
 
ATCA_DLL const atcacert_cert_element_t g_tngtls_cert_elements_3_device []
 
#define TNGTLS_CERT_TEMPLATE_3_DEVICE_SIZE   546
 
int tng_atcacert_max_device_cert_size (size_t *max_cert_size)
 Return the maximum possible certificate size in bytes for a TNG device certificate. Certificate can be variable size, so this gives an appropriate buffer size when reading the certificate.
 
int tng_atcacert_read_device_cert (uint8_t *cert, size_t *cert_size, const uint8_t *signer_cert)
 Reads the device certificate for a TNG device.
 
int tng_atcacert_device_public_key (uint8_t *public_key, uint8_t *cert)
 Reads the device public key.
 
int tng_atcacert_max_signer_cert_size (size_t *max_cert_size)
 Return the maximum possible certificate size in bytes for a TNG signer certificate. Certificate can be variable size, so this gives an appropriate buffer size when reading the certificate.
 
int tng_atcacert_read_signer_cert (uint8_t *cert, size_t *cert_size)
 Reads the signer certificate for a TNG device.
 
int tng_atcacert_signer_public_key (uint8_t *public_key, uint8_t *cert)
 Reads the signer public key.
 
int tng_atcacert_root_cert_size (size_t *cert_size)
 Get the size of the TNG root cert.
 
int tng_atcacert_root_cert (uint8_t *cert, size_t *cert_size)
 Get the TNG root cert.
 
int tng_atcacert_root_public_key (uint8_t *public_key)
 Gets the root public key.
 

Detailed Description

These methods provide some convenience functions (mostly around certificates) for TNG devices, which currently include ATECC608A-MAHTN-T.

Function Documentation

◆ tng_atcacert_device_public_key()

int tng_atcacert_device_public_key ( uint8_t *  public_key,
uint8_t *  cert 
)

Reads the device public key.

Parameters
[out]public_keyPublic key will be returned here. Format will be the X and Y integers in big-endian format. 64 bytes for P256 curve.
[in]certIf supplied, the device public key is used from this certificate. If set to NULL, the device public key is read from the device.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_max_device_cert_size()

int tng_atcacert_max_device_cert_size ( size_t *  max_cert_size)

Return the maximum possible certificate size in bytes for a TNG device certificate. Certificate can be variable size, so this gives an appropriate buffer size when reading the certificate.

Parameters
[out]max_cert_sizeMaximum certificate size will be returned here in bytes.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_max_signer_cert_size()

int tng_atcacert_max_signer_cert_size ( size_t *  max_cert_size)

Return the maximum possible certificate size in bytes for a TNG signer certificate. Certificate can be variable size, so this gives an appropriate buffer size when reading the certificate.

Parameters
[out]max_cert_sizeMaximum certificate size will be returned here in bytes.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_read_device_cert()

int tng_atcacert_read_device_cert ( uint8_t *  cert,
size_t *  cert_size,
const uint8_t *  signer_cert 
)

Reads the device certificate for a TNG device.

Parameters
[out]certBuffer to received the certificate (DER format).
[in,out]cert_sizeAs input, the size of the cert buffer in bytes. As output, the size of the certificate returned in cert in bytes.
[in]signer_certIf supplied, the signer public key is used from this certificate. If set to NULL, the signer public key is read from the device.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_read_signer_cert()

int tng_atcacert_read_signer_cert ( uint8_t *  cert,
size_t *  cert_size 
)

Reads the signer certificate for a TNG device.

Parameters
[out]certBuffer to received the certificate (DER format).
[in,out]cert_sizeAs input, the size of the cert buffer in bytes. As output, the size of the certificate returned in cert in bytes.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_root_cert()

int tng_atcacert_root_cert ( uint8_t *  cert,
size_t *  cert_size 
)

Get the TNG root cert.

Parameters
[out]certBuffer to received the certificate (DER format).
[in,out]cert_sizeAs input, the size of the cert buffer in bytes. As output, the size of the certificate returned in cert in bytes.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_root_cert_size()

int tng_atcacert_root_cert_size ( size_t *  cert_size)

Get the size of the TNG root cert.

Parameters
[out]cert_sizeCertificate size will be returned here in bytes.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_root_public_key()

int tng_atcacert_root_public_key ( uint8_t *  public_key)

Gets the root public key.

Parameters
[out]public_keyPublic key will be returned here. Format will be the X and Y integers in big-endian format. 64 bytes for P256 curve.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_atcacert_signer_public_key()

int tng_atcacert_signer_public_key ( uint8_t *  public_key,
uint8_t *  cert 
)

Reads the signer public key.

Parameters
[out]public_keyPublic key will be returned here. Format will be the X and Y integers in big-endian format. 64 bytes for P256 curve.
[in]certIf supplied, the signer public key is used from this certificate. If set to NULL, the signer public key is read from the device.
Returns
ATCACERT_E_SUCCESS on success, otherwise an error code.

◆ tng_get_device_cert_def()

ATCA_STATUS tng_get_device_cert_def ( const atcacert_def_t **  cert_def)

Get the TNG device certificate definition.

Parameters
[out]cert_defTNG device certificate defnition is returned here.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ tng_get_device_cert_def_ext()

ATCA_STATUS tng_get_device_cert_def_ext ( ATCADevice  device,
const atcacert_def_t **  cert_def 
)

Get the TNG device certificate definition.

Parameters
[in]devicePointer to the device context pointer
[out]cert_defTNG device certificate defnition is returned here.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ tng_get_device_pubkey()

ATCA_STATUS tng_get_device_pubkey ( uint8_t *  public_key)

Uses GenKey command to calculate the public key from the primary device public key.

Parameters
[out]public_keyPublic key will be returned here. Format will be the X and Y integers in big-endian format. 64 bytes for P256 curve.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ tng_map_get_device_cert_def()

const atcacert_def_t * tng_map_get_device_cert_def ( int  index)

Helper function to iterate through all trust cert definitions.

Parameters
[in]indexMap index
Returns
non-null value if success, otherwise NULL