Skip to content

Commit

Permalink
Add code comments on the different requirements for credential consta…
Browse files Browse the repository at this point in the history
…nts between evaluation and production systems. (FreeRTOS#386)

Only comments have changed.  No code changes.

Co-authored-by: Cobus van Eeden <[email protected]>
Co-authored-by: Gary Wicker <[email protected]>
  • Loading branch information
3 people authored Nov 9, 2020
1 parent 72e6c2c commit 596b466
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@
* must be unique; so edit as required to ensure that no two clients connecting to
* the same broker use the same client identifier.
*
* #define democonfigCLIENT_IDENTIFIER "...insert here..."
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
* must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier.
*
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@

/* If no username is defined, then a client certificate/key is required. */
#ifndef democonfigCLIENT_USERNAME

/*
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for
*!!! convenience of demonstration only. Production devices should
*!!! store keys securely, such as within a secure element.
*/

#ifndef democonfigCLIENT_CERTIFICATE_PEM
#error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h."
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
* must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier.
*
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/

Expand Down Expand Up @@ -133,6 +138,14 @@
/**
* @brief Client's private key.
*
*!!! Please note pasting a key into the header file in this manner is for
*!!! convenience of demonstration only and should not be done in production.
*!!! Never paste a production private key here!. Production devices should
*!!! store keys securely, such as within a secure element. Additionally,
*!!! we provide the corePKCS library that further enhances security by
*!!! enabling securely stored keys to be used without exposing them to
*!!! software.
*
* For AWS IoT MQTT broker, refer to the AWS documentation below for details
* regarding clientauthentication.
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ TLS mutual authentication for use with this MQTT demo.
"-----BEGIN CERTIFICATE-----\n" \
"...base64 data...\n" \
"-----END CERTIFICATE-----\n"
11. In the certs folder of your Documents, you will find a file called `client.key`.
12. In the certs folder of your Documents, you will find a file called `client.key`.
Copy its contents to `#define democonfigCLIENT_PRIVATE_KEY_PEM`. Keep in mind
that it must include the PEM header and footer and be formatted in this manner:
#define democonfigCLIENT_PRIVATE_KEY_PEM \
"-----BEGIN RSA PRIVATE KEY-----\n" \
"...base64 data...\n" \
"-----END RSA PRIVATE KEY-----\n"
12. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be

*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for convenience
*!!! of demonstration only. Production devices should store keys securely,
*!!! such as within a secure element.

13. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be
configured this way because the local MQTT broker will only have an IP
address but not a hostname. However, SNI (Server name indication) should
be enabled whenever possible.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@

/* If no username is defined, then a client certificate/key is required. */
#ifndef democonfigCLIENT_USERNAME

/*
*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for
*!!! convenience of demonstration only. Production devices should
*!!! store keys securely, such as within a secure element.
*/

#ifndef democonfigCLIENT_CERTIFICATE_PEM
#error "Please define client certificate(democonfigCLIENT_CERTIFICATE_PEM) in demo_config.h."
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@
* must be unique; so edit as required to ensure that no two clients connecting to
* the same broker use the same client identifier.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/

/**
Expand Down Expand Up @@ -132,6 +137,14 @@
/**
* @brief Client's private key.
*
*!!! Please note pasting a key into the header file in this manner is for
*!!! convenience of demonstration only and should not be done in production.
*!!! Never paste a production private key here!. Production devices should
*!!! store keys securely, such as within a secure element. Additionally,
*!!! we provide the corePKCS library that further enhances security by
*!!! enabling securely stored keys to be used without exposing them to
*!!! software.
*
* For AWS IoT MQTT broker, refer to the AWS documentation below for details
* regarding clientauthentication.
* https://docs.aws.amazon.com/iot/latest/developerguide/client-authentication.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ TLS mutual authentication for use with this MQTT demo.
"-----BEGIN CERTIFICATE-----\n" \
"...base64 data...\n" \
"-----END CERTIFICATE-----\n"
11. In the certs folder of your Documents, you will find a file called `client.key`.
12. In the certs folder of your Documents, you will find a file called `client.key`.
Copy its contents to `#define democonfigCLIENT_PRIVATE_KEY_PEM`. Keep in mind
that it must include the PEM header and footer and be formatted in this manner:
#define democonfigCLIENT_PRIVATE_KEY_PEM \
"-----BEGIN RSA PRIVATE KEY-----\n" \
"...base64 data...\n" \
"-----END RSA PRIVATE KEY-----\n"
12. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be

*!!! Please note democonfigCLIENT_PRIVATE_KEY_PEM in used for convenience
*!!! of demonstration only. Production devices should store keys securely,
*!!! such as within a secure element.

13. Update the config `democonfigdisableSNI` to `( pdTRUE )`. It needs to be
configured this way because the local MQTT broker will only have an IP
address but not a hostname. However, SNI (Server name indication) should
be enabled whenever possible.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
* must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier.
*
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
* must be unique so edit as required to ensure no two clients connecting to the
* same broker use the same client identifier.
*
*!!! Please note a #defined constant is used for convenience of demonstration
*!!! only. Production devices can use something unique to the device that can
*!!! be read by software, such as a production serial number, instead of a
*!!! hard coded constant.
*
* #define democonfigCLIENT_IDENTIFIER "insert here."
*/

Expand Down

0 comments on commit 596b466

Please sign in to comment.