Skip to content
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

Certificate validation issue when I try to read the certificate from the file instead of using cert.h file #11

Closed
rajvael opened this issue Jan 3, 2017 · 1 comment
Assignees

Comments

@rajvael
Copy link

rajvael commented Jan 3, 2017

I have created new crt file with the contents in cert.c file from azure-iot-sdk.

While initiating connection I have read the crt file and set the TrustedCerts option from the content in the crt file.

I am facing certificate validation error.
Error: ERR: server's cert didn't look good, X509_V_ERR = 20: error:00000014:lib(0):func(0):SSL lib

All the content in the cert.c are matching with the crt file but certificate validation fails.

Please let me know why this issue is occur?

Protocol : WebSocket over Amqp
Branch: 2016-11-17

Attached the crt file below ::

ca-certificates.crt.txt

Note: I have observed if I create a char array as global variable and load the certificate into that char array then its working. If i create a char array inside the function its not working.

@olivierbloch
Copy link
Contributor

Hi @rajvael
without seeing the code, it's hard to diagnose.
We are not planning to implement loading cert from file for now, but this could be an interesting contribution.
It seems that the cert data passed to the TrustedCerts option is not the same as the authentication fails. Can you check that the data you pass as option is exactly the same in both cases (from file or from code)?
Also regarding the difference in behavior when placing the cert data in the function vs. as a global variable, I suspect that as the data is passed by reference, you need it to persist beyond the scope of the function.
Hope this will help you solve the issue, and eventually send over a pull request for this.

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

4 participants