Skip to content

Conversation

@iabdalkader
Copy link

Main changes:

Update CA data:

Use a curated list of certificates that covers most of the Internet. This reduces the certificates size to 20KBs which can be loaded on all boards. The certs file is generated with: https://github.com/arduino/cacert-utils/

Support loading CA certs from the file system.

This patch adds support for automatically loading CA certificates from the filesystem. The file system certs are loaded on the first call to connectSSL(), once, and shared between all sockets.

If filesystem support is not enabled, or CA loading fails, the connection proceeds without error.

Custom CA certificates can still be passed via the 'cert' parameter, and both filesystem and custom certificates are registered with using different TLS tags. This allows users to add their own certs without recreating the whole file.

Testing

Enabled and tested on C33.

Using a curated list of certificates that covers most of
the Internet. This reduces the certificates size to 20KBs
which can be loaded on all boards.

Created with: https://github.com/arduino/cacert-utils/

Signed-off-by: iabdalkader <[email protected]>
This patch adds support for automatically loading CA certificates
from the filesystem. The file system certs are loaded on the first
call to connectSSL(), once, and shared between all sockets.

If filesystem support is not enabled, or CA loading fails, the
connection proceeds without error.

Custom CA certificates can still be passed via the 'cert' parameter,
and both filesystem and custom certificates are registered with
using different TLS tags. This allows users to add their own certs
without recreating the whole file.

Signed-off-by: iabdalkader <[email protected]>
@iabdalkader iabdalkader changed the title Tls ca data Support loading CA certs from the file system. Nov 6, 2025
@iabdalkader iabdalkader requested review from pennam and pillo79 November 6, 2025 13:14
@iabdalkader iabdalkader changed the title Support loading CA certs from the file system. libraries/SocketWrapper: Support loading CA certs from the file system. Nov 6, 2025
Copy link

@pillo79 pillo79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the changes to C33 config needed to sync that with other boards, or should these be applied more commonly?

Otherwise LGTM!

@iabdalkader
Copy link
Author

Are the changes to C33 config needed to sync that with other boards, or should these be applied more commonly?

Those options are going to be required by every board and at least 80KBs of heap for mbedtls, if we want to parse and load all of the certificates. I only enabled it for C33 because that's the only one I tested.

Note, I've managed to reduce the certs size from 64KBs to 20KBs with https://github.com/arduino/cacert-utils/ the file we have right now needs 140KBs of heap for mbedtls, and at least 64KBs of system heap.

@iabdalkader
Copy link
Author

@pillo79 Please don't merge this yet, it's not intended for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants