AnyCloud_MQTT_Client -- MQTT Client Certificate Configurations In configs/mqtt_client_config.h?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
skruglewicz
Level 4
Level 4
50 sign-ins First like received 5 solutions authored

Hello  

I'm going through the "README.md" on the GitHub repo and I'm confused on what to enter for the #define for the "MQTT CLIENT CERTIFICATION MACROS" in mqtt_client_config.h?

skruglewicz_0-1634413742540.png

 

I have generated the certification files. but not sure what "..........base64 data..........\n"  is?

Are these required?

skruglewicz_1-1634413870578.png

 

Any help would be appreciated

Regards

Steve K

 

 

0 Likes
1 Solution
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

1. So, do I open the 3 files (client.crt,client.key,ca.crt) in notepad and cut the  bytes between the Begin and end lines and paste them in to the string?

- Yes, please check the snapshot attached.

2. For the #define CLIENT_PRIVATE_KEY from the generated key file client.key, I would add a line for every line in the file as described below, to the String? 

- I think what you mean is addition of this part after every line -

\n"\. If this is the query then yes that needs to be done. Not required in the end of the private key and certificate.
You can check the snapshot attached.
 
Thanks
Aditi

 

 

 

View solution in original post

3 Replies
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

Basically, if you're using a secure connection/server that would require the use of client certificates, then you would have to provide the certificates in this file. The certificates and private keys will basically replace this part "..........base64 data..........\n". Let me know if more clarifications are required.

Thanks

Aditi

OK I understand that part.

but to your response:

 The certificates and private keys will basically replace this part "..........base64 data..........\n".

Questions:

So, do I open the 3 files (client.crt,client.key,ca.crt) in notepad and cut the  bytes between the Begin and end lines and paste them in to the string?

For the #define CLIENT_PRIVATE_KEY from the generated key file client.key, I would add a line for every line in the file as described below, to the String? This is not real data or complete. It shows 2 lines of many that are actually in the client.key file.

/* PEM-encoded client private key */
//#define CLIENT_PRIVATE_KEY \
"-----BEGIN RSA PRIVATE KEY-----\n" \
"0690zW6Lhep9S61\n" \
"gkqhkiG9w0B\n" \
".......\n" \
"-----END RSA PRIVATE KEY-----"

Thanks for you help.

0 Likes
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

1. So, do I open the 3 files (client.crt,client.key,ca.crt) in notepad and cut the  bytes between the Begin and end lines and paste them in to the string?

- Yes, please check the snapshot attached.

2. For the #define CLIENT_PRIVATE_KEY from the generated key file client.key, I would add a line for every line in the file as described below, to the String? 

- I think what you mean is addition of this part after every line -

\n"\. If this is the query then yes that needs to be done. Not required in the end of the private key and certificate.
You can check the snapshot attached.
 
Thanks
Aditi