CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
atcacert_def.h File Reference

Declarations for certificates related to ECC CryptoAuthentication devices. These are the definitions required to define a certificate and its various elements with regards to the CryptoAuthentication ECC devices. More...

#include <stddef.h>
#include <stdint.h>
#include "atca_compiler.h"
#include "atcacert.h"
#include "atcacert_date.h"
#include "atca_helpers.h"
#include "crypto/atca_crypto_sw.h"
#include "cal_buffer.h"

Data Structures

struct  atcacert_device_loc_s
 
struct  atcacert_cert_loc_s
 
struct  atcacert_cert_element_s
 
struct  atcacert_def_s
 
struct  atcacert_build_state_s
 

Macros

#define ATCA_MAX_TRANSFORMS   2
 
#define CA_DEV_SN_SIZE   9u
 
#define CA2_DEV_SN_SIZE_PART_1   4u
 
#define CA2_DEV_SN_SIZE_PART_2   5u
 
#define CA_DEV_SN_CONFIG_ZONE_OFFSET   0u
 
#define CA2_DEV_SN_CONFIG_ZONE_OFFSET_PART_1   0u
 
#define CA2_DEV_SN_CONFIG_ZONE_OFFSET_PART_2   8u
 

Typedefs

typedef enum atcacert_cert_type_e atcacert_cert_type_t
 
typedef enum atcacert_cert_sn_src_e atcacert_cert_sn_src_t
 
typedef enum atcacert_device_zone_e atcacert_device_zone_t
 
typedef enum atcacert_transform_e atcacert_transform_t
 How to transform the data from the device to the certificate.
 
typedef enum atcacert_std_cert_element_e atcacert_std_cert_element_t
 
typedef struct ATCA_PACKED atcacert_device_loc_s atcacert_device_loc_t
 
typedef struct ATCA_PACKED atcacert_cert_loc_s atcacert_cert_loc_t
 
typedef struct ATCA_PACKED atcacert_cert_element_s atcacert_cert_element_t
 
typedef struct atcacert_def_s atcacert_def_t
 
typedef struct atcacert_build_state_s atcacert_build_state_t
 

Enumerations

enum  atcacert_cert_type_e { CERTTYPE_X509 , CERTTYPE_CUSTOM , CERTTYPE_X509_FULL_STORED }
 
enum  atcacert_cert_sn_src_e {
  SNSRC_STORED = 0x0 , SNSRC_STORED_DYNAMIC = 0x7 , SNSRC_DEVICE_SN = 0x8 , SNSRC_SIGNER_ID = 0x9 ,
  SNSRC_PUB_KEY_HASH = 0xA , SNSRC_DEVICE_SN_HASH = 0xB , SNSRC_PUB_KEY_HASH_POS = 0xC , SNSRC_DEVICE_SN_HASH_POS = 0xD ,
  SNSRC_PUB_KEY_HASH_RAW = 0xE , SNSRC_DEVICE_SN_HASH_RAW = 0xF
}
 
enum  atcacert_device_zone_e {
  DEVZONE_CONFIG = 0x00 , DEVZONE_OTP = 0x01 , DEVZONE_DATA = 0x02 , DEVZONE_GENKEY = 0x03 ,
  DEVZONE_NONE = 0x07
}
 
enum  atcacert_transform_e {
  TF_NONE , TF_REVERSE , TF_BIN2HEX_UC , TF_BIN2HEX_LC ,
  TF_HEX2BIN_UC , TF_HEX2BIN_LC , TF_BIN2HEX_SPACE_UC , TF_BIN2HEX_SPACE_LC ,
  TF_HEX2BIN_SPACE_UC , TF_HEX2BIN_SPACE_LC
}
 How to transform the data from the device to the certificate. More...
 
enum  atcacert_std_cert_element_e {
  STDCERT_PUBLIC_KEY , STDCERT_SIGNATURE , STDCERT_ISSUE_DATE , STDCERT_EXPIRE_DATE ,
  STDCERT_SIGNER_ID , STDCERT_CERT_SN , STDCERT_AUTH_KEY_ID , STDCERT_SUBJ_KEY_ID ,
  STDCERT_NUM_ELEMENTS
}
 

Functions

ATCA_STATUS atcacert_get_subject (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, cal_buffer *cert_subj_buf)
 Gets the subject name from a certificate.
 
ATCA_STATUS atcacert_get_subj_public_key (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, cal_buffer *subj_public_key)
 Gets the subject public key from a certificate.
 
ATCA_STATUS atcacert_get_subj_key_id (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, uint8_t subj_key_id[20])
 Gets the subject key ID from a certificate.
 
ATCA_STATUS atcacert_get_issuer (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, uint8_t cert_issuer[128])
 Gets the issuer name of a certificate.
 
ATCA_STATUS atcacert_get_issue_date (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, atcacert_tm_utc_t *timestamp)
 Gets the issue date from a certificate. Will be parsed according to the date format specified in the certificate definition.
 
ATCA_STATUS atcacert_get_expire_date (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, atcacert_tm_utc_t *timestamp)
 Gets the expire date from a certificate. Will be parsed according to the date format specified in the certificate definition.
 
ATCA_STATUS atcacert_get_cert_sn (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, uint8_t *cert_sn, size_t *cert_sn_size)
 Gets the certificate serial number from a certificate.
 
ATCA_STATUS atcacert_get_auth_key_id (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, uint8_t auth_key_id[20])
 Gets the authority key ID from a certificate.
 
int atcacert_calc_expire_years (const atcacert_def_t *cert_def, const uint8_t *cert, size_t cert_size, int issue_tm_year, uint8_t *expire_years)
 

Detailed Description

Declarations for certificates related to ECC CryptoAuthentication devices. These are the definitions required to define a certificate and its various elements with regards to the CryptoAuthentication ECC devices.

Only the dynamic elements of a certificate (the parts of the certificate that change from device to device) are stored on the ATECC device. The definitions here describe the form of the certificate, and where the dynamic elements can be found both on the ATECC device itself and in the certificate template.

This also defines utility functions for working with the certificates and their definitions.