igrr / axtls-8266

axTLS port for ESP8266
Other
79 stars 33 forks source link

Not a valid ASN.1 file #10

Closed slaff closed 8 years ago

slaff commented 8 years ago

When integrating the code in another ESP8266 framework I am getting the following error before handshake.

Error: This is not a valid ASN.1 file
Error: Invalid X509 ASN.1 file (X509 not ok)

What can be the reason for this? With the Linux axtls code (without additions from this repo) it seems to work. Any suggestion?

igrr commented 8 years ago

Which server should I use to reproduce this?

slaff commented 8 years ago

I used the following key and certificate and I got this response testing with www.google.com and a lot of other servers. Actually I do not remember not getting this error.

igrr commented 8 years ago

I wonder why would you need client certificate when you connect to google.com... If the server doesn't request client certificate it is not used. Anyway, I'll check and see what's the issue with certificate loading.

noelgeorgi commented 8 years ago

is this because the client certificate was generated without -addtrust clientAuth in openssl?

slaff commented 8 years ago

@igrr @noelgeorgi It turned out that the key and certificate that I was passing to ssl_obj_memory_load were in PEM format, whereas axTLS expects them at that stage to be in DER format. Passing the data in DER format fixed the issue.