Universal Blynk IoT

Hello,

Has someone written software which is able to connect to:

  • Blynk cloud server,
  • local server with standard certificate or
  • local server with “Let’s Encrypt” certificate?

In fact, “Let’s Encrypt” certificate needs to define BLYNK_SSL_USE_LETSENCRYPT before including BlynkSimpleEsp8266_SSL.h.
Due to this symbol, I am not able to write software which will work in both situation.

Does someone have some hints?

Thanks in advance for your help

Steve

Yes, yes and yes! But never encountered the problem you describe. :thinking:

I think you can put this at the beginning of your sketch:

#define BLYNK_SSL_USE_LETSENCRYPT

You can’t use the exact same sketch to connect to both cloud and local server anyhow. Adding one extra line isn’t the end of the world :slight_smile:

Hello distans,

Precisely no, when I add this define the compiled program cannot connect to the server in the cloud. I did not found a workaround to be able to handle both situation with the same binary.

Steve

Do you mean the Blynk cloud servers?
If so, do you think they use a LetsEncrypt certificate?

Pete.

Hello Pete,

I know they do not use a “Let’s Encrypt” certificate.
But is there a way to have a firmware that can connect either to the Blynk cloud servers, or to a local server that uses a standard certificate or a “Let’s Encrypt” certificate?

Up to now I have to handle two firmwares: first one compiled without BLYNK_SSL_USE_LETSENCRYPT, second one compiled with BLYNK_SSL_USE_LETSENCRYPT.

Today, I want to merge both firmware in a single one that offers the end user the choice regarding the server and the certificate (“Let’s Encrypt” or not).

Steve

I don’t know, but I’d assume that you’d have to use an ifdef and endif block of code to switch them in and out, based on some parameter that the user selected.
I assume that you’re using something like WiFiManager to allow the user to select which configuration they require and to allow them to input the necessary credentials and certificate info?

Pete.

Hello Pete,

I suppose you mean #ifdef and #endif.
These directives have an effect at preprocessor time before compilation.
This means they have not effect at run time and therefore I have two different firmware today.
What I am looking for is a way to allow the end user to make their choice at run time.

Exactly, I use something like WiFiManager.

Steve

Yes, I’d forgotten that ifdef is a compile time switch, which obviously won’t help you.
Presumably you’ve tried using a regular if statement?

Pete.

Hello,

I continue to dig into this subject.
I saw that it is possible to use a fingerprint parameter in config method.
I am not comfortable with certificates and fingerprints.
How to get a fingerprint that works with a let’s encrypt certificate?
Are the two methods (fingerprint and der certificate) similar in terms of security?

Thank you for your help

Steve