Skip to content

BearSSL with Insecure HTTPS #5620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
coder137 opened this issue Jan 16, 2019 · 2 comments
Closed

BearSSL with Insecure HTTPS #5620

coder137 opened this issue Jan 16, 2019 · 2 comments

Comments

@coder137
Copy link

Hey, I found this thread when facing the same issue. #5277

When using BearSSL::WifiClientSecure
I get code -1 with https.get

HTTPClient https;
BearSSL::WiFiClientSecure newSecure;
newSecure.setInsecure();
int checkBegin = https.begin(newSecure, "raw.githubusercontent.com", 443, "/coder137/TM4C123G/master/.gitattributes", false);
Serial.println(checkBegin);

int code = https.GET();
String payload = https.getString();
Serial.println(code);
Serial.println(payload);

// !
https.end();
newSecure.stop();

However when using the default axTLS::WifiSecure
This works perfectly

HTTPClient https;
WiFiClientSecure newSecure;
int checkBegin = https.begin(newSecure, "raw.githubusercontent.com", 443, "/coder137/TM4C123G/master/.gitattributes", false);
Serial.println(checkBegin);

int code = https.GET();
String payload = https.getString();
Serial.println(code);
Serial.println(payload);

// !
https.end();
newSecure.stop();

However in the docs it has been written that BearSSL is preferred over axTLS since the latter is deprecated.
Am I doing something wrong or is this a bug?

@Jeroen88
Copy link
Contributor

What if you try true at the https.begin() function? You are using the secure WiFi client over port 443, so https should be true, but without setting security credentials (because of setInsecure())

@coder137
Copy link
Author

Amazing this works as intended.

For reference this is the code I used

HTTPClient https;
BearSSL::WiFiClientSecure secureClient;
secureClient.setInsecure();
int checkBegin = https.begin(secureClient, "raw.githubusercontent.com", 443, "/coder137/TM4C123G/master/.gitattributes", true);
Serial.println(checkBegin);

int code = https.GET();
String string = https.getString();
Serial.println(code);
Serial.println(string);

https.end();
secureClient.stop();

Thanks a lot for your help @Jeroen88 🥇

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

No branches or pull requests

2 participants