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.

We want to know how to send JSON post using secured HTTP (HTTPS) by using CC3200 launch expo

Other Parts Discussed in Thread: CC3200, CC3200SDK

Hi 

We are trying to establish connection with SSL by using CC3200launchXL.

Query 1:

We want to know how to send JSON post using secured HTTP (HTTPS), below are the details:

HTTP Method:

POST

Output Format:

JSON

Sample URL:

https://test.apps.lifetechnologies.com/egw/endurancegw/api/v1/devices/register

Sample Input :

 

 

Below is the server response:

{"serialNumber": "2453", "username": "xxxx@gmail.com", "password": "****", "deviceType":"Endurance", "deviceMetadata":{"color": "white", "type": "Freezer", "location":"LAB-1 56"}}

 

Sample Output:

{"token": "EiQ5qbgBx9iEikQ7hzZ/UGY6nzPecmrcYEQOPdOi","instrumentRegistrationId":1,"username":"user"}

 

Query 2:

We are trying to establish connection with SSL by using CC3200launchXL. We are unable to see the console data. But we tested with HTTP client its working fine and we are able to see the console data.

 

Could you please help in resolving these issues?

Thanks in advance.

  • Hi Surya,


    Please refer http_client example to post data in JSON format. There is no difference in the way post request formatted for http or https except for some extra header needed depend upon the server. For https only connection need to be secure. Please refer ssl example from SDK for establishing secure connection.


    Regards,
    Aashish
  • Hi Surya,

    I have open source code and instructions that shows how to do this - github.com/.../CC3200_Azure

    Note, this does not use the HTTP Client Libraries, but instead I build the HTTP POST packet on top of the Sockets packet.

    Glenn.
  • Hi Glenn,

    Thanks for your reply.

    we compiled source code(github.com/.../CC3200_Azure) by using IAR work bench, but we are getting the following compilation Issues.

    Error[Pe040]: expected an identifier D:\SURYA_WIFI\CC3200SDK_1.1.0\cc3200-sdk\oslib\osi.h 59
    Error[Pe020]: identifier "PERIODIC_TEST_CYCLES" is undefined D:\SURYA_WIFI\CC3200SDK_1.1.0\cc3200-sdk\example\ssl1_test\main.c 541

    Could you please help in resolving these issues?

    Thanks in Advance.

    Regards,
    Surya
  • My projects are CCS projects
  • Hi Glen,

    Thanks for ur reply.

    How to implement HTTP SSL connection with server without out using certificate(SL_SSL_CA_CERT_FILE_NAME).

    Regards,
    Surya
  • I am not aware of any method that allows you to create a secure socket with out installing a certificate
  • Hi,

    By using cc3200 launch Http client code we implemented HTTP secure connection(SSL)and I tried with the following hosts .

    Host:Google
    port:443
    Downloaded google certificate in flash.

    O/P:
    Host Driver Version: 1.0.0.10<LF><CR>
    Build Version 2.2.0.1.31.1.2.0.2.1.0.3.23<LF><CR>
    Device is configured in default state <LF><CR>
    Device started as STATION <LF><CR>
    [WLAN EVENT] STA Connected to the AP: surya1234 , BSSID: 88:70:8c:d1:27:dc<LF><CR>
    [NETAPP EVENT] IP Acquired: IP=192.168.43.113 , Gateway=192.168.43.1<LF><CR>
    Connected to the AP: surya1234<CR><LF>
    Connection to server created successfully


    Now I am trying to connect httpbin.org host ,but I am unable to connect .

    Host: httpbin.org
    port:443

    O/P:
    Host Driver Version: 1.0.0.10<LF><CR>
    Build Version 2.2.0.1.31.1.2.0.2.1.0.3.23<LF><CR>
    Device is configured in default state <LF><CR>
    Device started as STATION <LF><CR>
    [WLAN EVENT] STA Connected to the AP: surya1234 , BSSID: 88:70:8c:d1:27:dc<LF><CR>
    [NETAPP EVENT] IP Acquired: IP=192.168.43.113 , Gateway=192.168.43.1<LF><CR>
    Connected to the AP: surya1234<CR><LF>
    Connection to server failed. error(-102)<LF><CR>
    Error [-2011] at line [1234] in function [ConnectToHTTPServer] <LF><CR>

    Please tell me any testing hosts for testing HTTP secure connections

    Could you please help in resolving these issues?

    Thanks in Advance.

    Regards,
    Surya
  • Hi Surya,


    Did you flashed certificates related to httpbin.org


    Regards,
    Aashish
  • Hi,

    Please tell me any testing hosts for testing HTTP secure connections.

    Regards,
    Surya
  • Hi Surya,


    You can try with https://www.howsmyssl.com/


    Regards,
    Aashish
  • Hi,

    I am working on CC3200 and trying to connect to webserver securely (SSL). I have followed the guide lines at

    processors.wiki.ti.com/.../CC32xx_SSL_Demo_Application

    and was able to connect to google server successfully.

    But now my requirement is not to preload the CA certificate on to SFLASH but still I need to connect to the web server.

    Can some one let me know some example or procedure how to connect to webserver without preloading the CA certificate
    on to flash since in run time I should be able to connect to the server dynamically.

    Thanks in advance
  • Hi,

    I need to connect to apps.lifetechnologies.com
    I have to send user name and password as part of POST in json format and be able to login to the above mentioned site
    Any suggestions on this?

    Thanks in advance

    Regards,
    Pavan
  • Hi Glen,

    In source code I have some doubts

    In Main.c

    #define AUTHHEADER "Authorization: SharedAccessSignature sr=swiftsoftware-ns.servicebus.windows.net&sig=6sIkgCiaNbK9R0XEpsKJcQ2Clv8MUMVdQfEVQP09WkM%3d&se=1733661915&skn=EventHubPublisher\r\n"

    what is the AUTHHEADER ? How to generate this code for our application.Tell me the procedure how to generate this signature.

    Could you please help in resolving these issues?

    Thanks in advance

    Regards,
    Surya
  • This is all detailed with my IoT Proof of Concept - github.com/.../CC3200-LaunchPad-Setup

    Look at - Generate Shared Access Token..

    Are you sending the packets to Microsoft Azure?

    Glenn
  • Hi Glenn,

    No,By using your application source code we are trying to connect //test.apps.lifetechnologies.com/egw/endurancegw/api/v1/devices/register

    we did the following modifications.

    Changed Host address ://test.apps.lifetechnologies.com/egw/endurancegw/api/v1/devices/register
    Flashed certificate in CC3200 launch Expo,

    but still we are unable to connect the host.

    Could you please help in resolving these issues?

    Thanks in advance

    Regards,
    Surya
  • The Token you see is for Azure's method of Claims Based Authentication....I have no idea if you require this on your site, most likely not. Hence you can forget about that Header.

    Regarding your issues, what error are you getting returned, any other information to help you debug the issue?

    You will need to use the root CA that is required for your site....it may not be the same one i use for Azure. 

    I recommend going through these steps -  

    Glenn,

  • Hi Glenn,

    I was uploaded root CA certificate of my site as per the above mentioned steps.But still we are unable to connect.

    Regards,
    Surya
  • What line of code have determined fails? What error number is returned? What else have you done to debug this issue?

    Please share the site URL and upload the root ca you are using to a post as a zip file.

    Glenn
  • Hi Glenn,

    Thanks for your reply,

    Requirement:
    Host Server: test.apps.lifetechnologies.com
    Port=443
    Connection type=SSL

    These are the modifications implemented in code.

    #define HOST_NAME "test.apps.lifetechnologies.com"
    #define HOST_PORT 443
    #define POSTHEADER "POST test.apps.lifetechnologies.com/.../register HTTP/1.1\r\n"

    #define SL_SSL_CA_CERT_FILE_NAME "/cert/129.der"(created file as per the SSL example code and flashed certificate)

    ucMethod = SL_SO_SEC_METHOD_TLSV1;
    uiCipher = SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA;


    we are getting error number (-340 ) while connecting to the peer device.

    /* connect to the peer device - Google server */
    lRetVal = sl_Connect(iSockID, ( SlSockAddr_t *)&Addr, iAddrSize);

    Error Number=-340(SL_ESEC_HANDSHAKE_FAILURE)

    Console output:

    Host Driver Version: 1.0.0.10<LF><CR>
    Build Version 2.2.0.1.31.1.2.0.2.1.0.3.23<LF><CR>
    Device is configured in default state <LF><CR>
    Device started as STATION <LF><CR>
    [WLAN EVENT] STA Connected to the AP: surya1234 , BSSID: 88:70:8c:d1:27:dc<LF><CR>
    [NETAPP EVENT] IP Acquired: IP=192.168.43.113 , Gateway=192.168.43.1<LF><CR>
    Connection established w/ AP and IP is aquired <LF><CR>
    Device couldn't connect to server <LF><CR>

    Could you please help in resolving these issues?

    Regards,
    Surya
  • Hi Surya,


    Is it CA uses SHA384 as what we can see in browser. If yes, sorry CC3200 doesn't support SHA384.


    Regards,
    Aashish