This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3200MODLAUNCHXL: CC3200: Troubleshooting simple socket connection to AWS

Part Number: CC3200MODLAUNCHXL
Other Parts Discussed in Thread: CC3200

This is a follow-up post related to this post.

In brief: I am attempting to use TI's CC3200 SDK to make a simple socket connection to AWS. Initially I had issues with my certificates which I believe has been resolved: I no longer receive any bad certificate or bad key errors*. This was confirmed by using the same DER formatted certificates I flashed to the CC3200 to connect to AWS using openssl (script formatted here for readability):

openssl s_client
    -connect <endpoint>.iot.<region>.amazonaws.com:8443
    -cipher 'ECDHE-ECDSA-AES128-SHA256'
    -CAfile .\symantecCert.pem
    -cert .\cert.der -certform DER
    -key .\privateKey.der -keyform DER

Note: I am using a DER formatted CA file (not PEM formatted as implied above) with the CC3200. OpenSSL did not work with DER formatted CA file (though the CC3200 does not throw CA error and I am 99% certain my DER formatted CA file is correct). I have also specified the SL_SO_SEC_METHOD_TLSV1_2 method and SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 cipher. In fact, I've used both this and the RSA equivalent cipher (1 <<8) .

*openssl fails to convert keys from PEM to DER (Error 0906D06C --> Expecting TRUST CERTIFICATE). I wrote my own program to blindly convert quadruples of base64 encoded values to 3 bytes. This was successful for the CA and certificate files (as compared to successful openssl conversions) and I merely hope the conversion is successful for the keys. Again, I no longer see bad key errors which gives me confidence that the DER formatted keys are correct, but I have no idea how sl_Connect actually works so I could easily be wrong.

My Problem:

While openssl s_client works with these parameters, the CC3200 throws an error -461, which according to the associated comment means 'Connected with certificate date verification error'. I would like to know:

a) what causes this error to be thrown? There does not appear to be an equivalent error from openssl.

b) how do I resolve this issue?

Thanks for your help, in advance!

  • Hi Tarun,

    What a great explanation of the problem at hand - thank you!

    I'm not yet sure of the root cause and am investigating.

    With respect to the conversion from PEM to DER, does this command work for you?

    openssl x509 -in cert.pem -outform der -out cert.der

    Sincerely,
    Bryan Kahler
  • Briefly, it works for certificates but fails on keys.
    When converting certificates, that openssl command works perfectly. In fact I used it to help verify my own pem2der.c.
    However, it always failed to convert private keys. It throws a missing trusted certificate error. And so I wrote pem2der.c specifically for key conversion. It is essentially a replica of the algorithm in certflash.c that is part of the AWS SDK.
  • Hi Tarun,

    Which version of the AWS example are you using? Are you able to successfully sync with the NTP server? The v2.1.0 example is hardcoded to use pool.ntp.org. Invalid times could cause this issue.

    Sincerely,
    Bryan Kahler
  • Hi Bryan,

    Indeed you are correct! I did not have the date/time of my device correctly set. Thank you for your feedback Bryan!

    For the benefit of others reading this:

    To resolve this issue I correctly used the sl_DevSet() to set the device time:

    sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME, sizeof(SlDateTime_t),(unsigned char *)(&time));

    My variable time (which is of type SlDateTime_t) was not set properly.

    T