719.260.1625  
The cart is empty
Log in Register

eGuard Library Commands

egAuthenticate ()

perform an authentication operation using the eGuard device. There are multiple types of authentication operations that can be performed.

Syntax

egDetectDevice (authentication_type, params)

Parameters

authentication_type – determines the type of authentication to be performed.  - AuthenticationType

          SYMMETRIC      - authenticate using a symmetric key.

PKI_DEVICE     - authenticate using device private/public key pair.

PKI_CHAIN      - authenticate using device private/public key pair and verify chain of trust to root authority.

params – a set of parameters dependent on the type of authentication being performed. - uint8_t *

          SYMMETRIC      - NULL

          PKI_DEVICE      - public key of device

          PKI_CHAIN       - NULL

Returns

ATCA_Status

Example

ATCA_STATUS status;

status = egAuthenticate(SYMMETRICc, NULL);

if (status == ATCA_SUCCESS)

          // eGuard properly accessed and authentication was successful.

else

          // eGuard could not be accessed or authentication failed.

egDetectDevice ()

verifies an eGuard device can be accessed on the I2C bus.

Syntax

egDetectDevice ()

Parameters

none

Returns

ATCA_Status

Example

ATCA_STATUS status;

status = egDetectDevice ();

if (status == ATCA_SUCCESS)

          // eGuard properly accessed.

else

          // eGuard could not be accessed.

egDevicePubKey()

Return the public key associated with the device’s private key.

Syntax

egDevicePubKey(pubkey)

Parameters

pubkey –– uint8_t[ATCA_PUB_KEY_SIZE]

Returns

Always returns ATCA_SUCCESS.

Example

ATCA_STATUS status;

uint8_t pubkey[ATCA_PUB_KEY_SIZE];

status = egDevicePubKey (pubkey);

if (status == ATCA_SUCCESS)

          // PublicKey is valid.

else

          // eGuard device not selected or PublicKey is invalid.

egGenRandom()

Returns a 32-byte random number from the eGuard device.

Syntax

egGenRandom (random_number)

Parameters

random_number – pointer to 32-byte array to hold the random_number data. – uint8_t *

Returns

ATCA_Status

Example

ATCA_STATUS status;

uint8_t random_number[32];

status = egGenRandom (random_number);

if (status == ATCA_SUCCESS)

          // eGuard properly accessed and random_number is valid.

else

          // eGuard could not be accessed and random_number is invalid.

egGetConfig()

Return the revision and information about hardware.

Syntax

egGetConfig (configuration)

Parameters

FIXME configuration – structure containing revision and hardware information. - CfgStructure

Returns

ATCA_Status

Example

ATCA_STATUS status;

FIXME: CfgStructure config;

status = egGetConfig (config);

if (status == ATCA_SUCCESS)

          // eGuard properly accessed and configuration information is valid.

else

          // eGuard could not be accessed and configuration information is invalid.

egGetRev()

Return the revision of software.

Syntax

egGetRev (software_revision)

Parameters

software_revision – character 12-byte array holding the software revision – uint8_t[SW_REVISION_SIZE]

Returns

Always returns ATCA_SUCCESS.

Example

char sw_rev[12];

egGetRev(sw_rev);

egSelectDevice()

Select an eGuard device to be used for subsequent operations.

Syntax

egSelectDevice (device_configuration)

Parameters

device_configuration – structure holding the device configuration information. The structure is built into the library and does not need to be initialized prior to use.

          The default structure to use is A0-SKT-01.

Returns

ATCA_Status

Example

ATCA_STATUS status;

status = egSelectDevice (&A0-SKT-01);

if (status == ATCA_SUCCESS)

          // eGuard device properly selected.

else

          // eGuard device not selected.

egSernum()

Reads the serial number from the eGuard device. Each eGuard device has a unique nine (9) byte serial number.

Syntax

egSernum (serial number)

Parameters

sernum – nine (9) byte serial number – uint8_t

ATCA_SERIAL_NUM_SIZE – 9 – define

Returns

ATCA_Status

Example

ATCA_STATUS status;

uint8_t sernum[ATCA_SERIAL_NUM_SIZE];

status = egSernum (sernum);

if (status == ATCA_SUCCESS)

          // eGuard device properly accessed and sernum is valid.

else

          // eGuard device could not be accessed and sernum is invalid.