This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

1NCE Onboarding SIM Card

Hi,

I try to do the Onboarding workflow for 1NCE SIM Cards with the NRF91 Module: 1nce.com/.../

So the solution is to send a GET Request to a special endpoint and you get all your certificates. At the moment I´m confused. In the documentation it says you need to access the endpoint via HTTPS. If I do so, the server answers:


GOT HTTP/1.1 400 Bad Request
Server: awselb/2.0
Date: Thu, 14 Jan 2021 20:48:00 GMT
Content-Type: text/html
Content-Length: 220
Connection: close
<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
</body>
</html>

So what could be the solution? There is nothing about any certificate in the documentation. My Code is a modified one from the "https_client" sample.

https://pastebin.com/yuTTaD4k

Thanks for your help end best regards.

Parents Reply Children
  • response is a bit bigger (with certificates) but i dont think 2kb. What would be the solution here?

    Edit: I think it is over 2KB limit because the single certs are even bigger.

    HTTP/2 200

    server: awselb/2.0

    date: Mon, 22 Jun 2020 14:26:15 GMT

    content-type: application/json; charset=utf-8

    content-length: 3156

    etag: W/“c54-l8hc4And5ODwW2GDRbihJtLzNrI“

    access-control-allow-origin: *

    {

    „certificate“: „—–BEGIN CERTIFICATE—–\HERE_WOULD_BE_CERTIFICATE\n—–END CERTIFICATE—–\n“,

    „privateKey“: „—–BEGIN RSA PRIVATE KEY—–\HERE_WOULD_BE_KEY\n—–END RSA PRIVATE KEY—–\n“,

    „amazonRootCaUrl“: „www.amazontrust.com/.../AmazonRootCA1.pem“,

    „iotCoreEndpointUrl“: „a259hu9tuXXXXX-ats.iot.eu-central-1.amazonaws.com“,

    „ICCID“: „898828066600000XXXX”

    }

  • One thing you could try, is to use the content-range header field to see if you can download just a part of the certificates.

    This is what we are doing in our download_client, to download DFU images.

  • Okay but shouldn´t I get anything from the server also if the size is bigger? I mean the first package at least and normaly the revc loops as long as there is content. So in the demo implementation from once in RTOS it does exactly this: https://pastebin.com/edA7HMLg also they use port 443 and TCP for the socket whats also strange for me

  • If I do a HEAD request, I get a response. Also I get a 503 Error if I change the URL Path. So this seems to work. now is the question how to download the content.

    HTTP/1.1 200 OK

    Server: awselb/2.0

    Date: Fri, 15 Jan 2021 15:15:58 GMT

    Content-Type: text/csv; charset=utf-8

    Content-Length: 0

    Connection: keep-alive

    etag: W/"10c3-H17P8ulLBfQxnRd+jSKR4RP6v3U"

    access-control-allow-origin: *

    x-powered-by: Express

  • The download_client asks for a specific range: "Range: bytes=%u-%u\r\n"

    The start of the range is the current offset, while the end is MIN(offset + wanted fragment size, total file size).

     

    danielboe said:
    Okay but shouldn´t I get anything from the server also if the size is bigger?

     What happens is that the device will start downloading encrypted data, but it cannot decrypt it until the whole TLS fragment is downloaded. The encrypted data is therefore stored in a buffer of 2kB. But, as the TLS fragment is larger, the buffer cannot hold it all, and the fragment cannot be decrypted. It is therefore dropped.

Related