Skip to content

Commit

Permalink
Replace automatic SSL certificate generation with generate_cert bui…
Browse files Browse the repository at this point in the history
…ld target
  • Loading branch information
mikee47 committed Jun 5, 2024
1 parent 984705c commit 0b1edd2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
14 changes: 14 additions & 0 deletions Sming/Components/ssl/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ Sming supports multiple SSL implementations, currently with adapters for:
If you want to use SSL then take a look at the :sample:`Basic_Ssl` sample for creating SSL clients,
and :sample:`HttpServer_ConfigNetwork` for SSL servers.

Certificates
------------

If you need an X509 certificate and private key::

make generate-cert

This will use openssl to generate binary certificate and key information in ``out/ssl``
and create ``include/ssl/cert.h`` and ``include/ssl/private_key.h``.
See :sample:`MqttClient_Hello` and :sample:`SmtpClient` for how these are used in code.

An alternative to generating header files is to use the binary certificate files directly.
See :sample:`Basic_AWS` for an example of this approach.


Configuration Variables
-----------------------
Expand Down
8 changes: 5 additions & 3 deletions Sming/Components/ssl/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ ifeq ($(ENABLE_SSL),0)
else
$(info Using $(ENABLE_SSL) SSL implementation)

# Application
CUSTOM_TARGETS += include/ssl/private_key.h
##@Tools

.PHONY: generate_cert
generate_cert: include/ssl/private_key.h ##Generate X509 certificate and private key files in include/ssl

SSL_TOOLS_PATH := $(COMPONENT_PATH)/Tools
SSL_INCLUDE_DIR := $(PROJECT_DIR)/include/ssl
OUT_SSL := out/ssl/
OUT_SSL := out/ssl/
SSL_CERT_DIR := $(OUT_SSL)/cert

include/ssl/private_key.h:
Expand Down

0 comments on commit 0b1edd2

Please sign in to comment.