3.2.6.6 ECC System Service
The ECC Service provides APIs to execute the following functionality:
- Reading the Serial number from the ECC-608 device.
- Reading the certificate –
device/ signer/ root
. - Switching between TrustNGo and TrustFlex ECC-608 devices on the RNWF11 Add On Board.
- Writing into a Slot in the ECC-608 device.
- Reading from a Slot.
The RNWF11 provides the configuration options for ECC System Service.
RNWF Supported ECC608 Variants – From the dropdown list, choose the required secure device.
Available options are:
- TNGTLS
- TFLEX
The ECC-608 Service API prototype is as
follows:
RNWF_RESULT_t RNWF_ECC_SrvCtrl(RNWF_ECC_SERVICE_t request, void *input);
The following table lists the RNWF11 services and reports the results to the application over the return code.
Option/Command | Input | Remarks |
---|---|---|
RNWF_ECC_RD_SER | None | Reads the Serial Number from the ECC device |
RNWF_ECC_WR_DEV_TYPE | Device Type | Switches to TrustNGo or TrustFlex |
RNWF_ECC_RD_CERT | Certificate Type, No of Bytes to read | Reads the n bytes from the certificate – device/ signer/ root and lets the user know about the remaining bytes |
RNWF_ECC_WR_SLOT | Slot, Offset, Length, Data | Writes the data into the ‘Data’ Zone of the slot number provided by the user |
RNWF_ECC_WR_ZONE_SLOT | Zone, Slot, Offset, Length, Data | Writes the ‘Data’ into the Zone and the slot number provided by the user |
RNWF_ECC_RD_SLOT | Slot, Offset, Length | Reads the data into the buffer from the ‘Data’ Zone of the slot number provided by the user |
RNWF_ECC_RD_ZONE_SLOT | Zone, Slot, Offset, Length | Reads the data into the buffer from the Zone and the slot number provided by the user |
Following is an example of reading a certificate from the ECC
device.
RNWF_ECC_CERT_CFG_t cert_cfg; int main(void) { memset(&cert_cfg, 0, sizeof(cert_cfg)); cert_cfg.cert_type = 1; //Device certificate cert_cfg.length = 1000; //Number of bytes to be read RNWF_ECC_SrvCtrl(RNWF_ECC_RD_CERT, &cert_cfg); printf("Bytes Read %d ; Bytes Remaning = %d\r\n", cert_cfg.bytes_read, cert_cfg.remaining_bytes); printf("Cert:%s\r\n", cert_cfg.cert); }
Following is an example of reading data from the ECC device
slot.
int main(void)
{
RNWF_ECC_SLOT_CFG_t slot_cfg;
memset(&slot_cfg, 0, sizeof(slot_cfg));
slot_cfg.length = 16;
slot_cfg.offset = 0;
slot_cfg.slot_num = 8;
slot_cfg.zone_type = 2;
RNWF_ECC_SrvCtrl(RNWF_ECC_RD_ZONE_SLOT, &slot_cfg);
printf("Slot Data:%s\r\n", slot_cfg.data);
}