Skip to content

Commit c405422

Browse files
committed
Corrected the comments about the treatment of device certs when using TrustCUSTOM v/s other variants - added code that will plug in the provided custom device cert to the network context. No code needed for other variants - esp-tls handles device cert attachment internally
1 parent 31b21c4 commit c405422

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

demos/projects/ESPRESSIF/esp32/components/sample-azure-iot/transport_tls_esp32.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,20 @@ TlsTransportStatus_t TLS_Socket_Connect( NetworkContext_t * pNetworkContext,
9494

9595
esp_transport_ssl_use_secure_element( pNetworkContext->xTransport );
9696

97-
#ifndef CONFIG_ATECC608A_TNG
98-
/* This is either a TrustFLEX or a TrustCUSTOM chip - generate (using atcacert_* API) or plug in
99-
your certificate here (if the CSR was generated using ATECC608 and cert is available as a .der)
97+
#ifdef CONFIG_ATECC608A_TCUSTOM
98+
/* This is TrustCUSTOM chip - the private key will be used from the ATECC608 device slot 0.
99+
We will plug in your custom device certificate here (should be in DER format).
100100
*/
101+
if ( pNetworkCredentials->pucClientCert )
102+
{
103+
esp_transport_ssl_set_client_cert_data_der( pNetworkContext->xTransport, ( const char *) pNetworkCredentials->pucClientCert, pNetworkCredentials->xClientCertSize );
104+
}
105+
106+
101107
#else
102-
/* No action needed - cryptoauthlib will generate and attach the cert to the network context */
108+
/* This is either the Trust&GO or the TrustFLEX chip - the private key will be used from ATECC608 device slot 0.
109+
We don't need to add certs to the network context as the esp-tls does that for us using cryptoauthlib API.
110+
*/
103111

104112
#endif
105113

0 commit comments

Comments
 (0)