ESP32 with CA + PRIVATE + CERTIFICATE

Posted on
  • Gordon
    I followed the instructions
    http://www.espruino.com/Storing+HTTPS+Ce­rtificates
    And make execute
    https://www.dropbox.com/s/dj6fcj0039064b­j/gordon.png?dl=0
    But got always the same error during executing...
    have you idea about ?


    1 Attachment

    • a.png
  • Wed 2019.09.18

    Hi @tcpipchip

    This seems to be a continuation of content from this thread, am I correct?

    http://forum.espruino.com/conversations/­323658/?offset=50#comment14901112

    See #64 in above thread, for Gordon's succinct position with ESP32 on this matter.

    http://forum.espruino.com/comments/14898­601/   #64

    While @Gordon is focusing his skill set on Authentic Espruino boards, and his time is valuable, others might be able to assist. It would be nice to know the environment and available memory. Please post the results of process.memory() and process.env for others to garner detail in your setup.

  • Yes, i was on wrong topic, sorry!

    I will post that values before to run the script that call routine with certificates

    Sorry again! I have to make that work to put to in my AWS IOT book with ALEXA

  • |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >Saving ca
    Saving key
    Saving cert
    Connecting to Wifi
    Connected...
    { "free": 2155, "usage": 145, "total": 2300, "history": 485,
      "gc": 0, "gctime": 2.03 }
    {
      "VERSION": "2v04",
      "GIT_COMMIT": "3956264e",
      "BOARD": "ESP32",
      "FLASH": 0, "RAM": 524288,
      "SERIAL": "a4cf1275-31c8",
      "CONSOLE": "Serial1",
      "MODULES": "Flash,Storage,heatshrink,fs,net,dgram,t­ls,http,NetworkJS,Wifi,TelnetServer,cryp­to,neopixel",
      "EXPTR": 1073484860 }
    Acessing AWS IOT
    Connecting...
    Uncaught InternalError: HTTPS init failed! mbedtls_x509_crt_parse of 'ca': Invalid format
     at line 75 col 10
      }).end();
             ^
    in function called from system
    >
    

    Source code
    https://www.dropbox.com/s/3i0cig5pl9qtd7­e/code.js?dl=0

    Let me know if runs in your ESP32

  • Confirming: Is the amount of free mem that after the entire upload of source code?

    "free": 2155, "usage": 145
    

    The usage seems to suggest that no certificate code has been uploaded?

  • @Robin the certificates end up in flash memory so won't use RAM.

    You could try confirming that the certificates really are the same as you put in... eg:

    oca == atob("MIIFgDCCA2gCCQD1KANs3obrTjANBgkqhk­iG9w0BAQsFADCBgTELMAkGA1UEBhMCVVMxCzAJBg­NVBAgTAk1BMQ8wDQYDVQQHEwZCb3N0b24xEzARBg­NVBAoTCkV4YW1wbGUgQ28xEDAOBgNVBAsTB3RlY2­hvcHMxCzAJBgNVBAMTAmNhMSAwHgYJKoZIhvcNAQ­kBFhFjZXJ0c0BleGFtcGxlLmNvbTAeFw0xNTExMj­cxMjIyMzFaFw00MzA0MTMxMjIyMzFaMIGBMQswCQ­YDVQQGEwJVUzELMAkGA1UECBMCTUExDzANBgNVBA­cTBkJvc3RvbjETMBEGA1UEChMKRXhhbXBsZSBDbz­EQMA4GA1UECxMHdGVjaG9wczELMAkGA1UEAxMCY2­ExIDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1wbG­UuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMI­ICCgKCAgEAwjlJ3eyrnGIiJiplY5mvIaaoMC20oR­4Jx5+FOXNJJhjSz9mOoqcpEe2U6ZmmVfcpc8zdt1­f9KkED5yjzpnF02CG+KYaRs/Rfj0NJejcpBN3Hn4­R6+yJek2rYrKi4uZyMZrWx/8PTp/lEypAEBf/2vX­9WYNgi5eWyHeHEfJ4yucRI1UgRw5W/RLYoAePAPT­1ekB66NbosBIZhRXJvjqED/jOMOlpHgNPQHTUyPj­5lR8ZTSduATUQac6qRx9pdYyVICVE8bxma56R0pX­8Cdx/wg+5gKOXUPuXW1xTPNuH4JpNTd7huJwa8Ff­0ReKTLHZk1hYB7uDzL5moc8kylYEwz2W13KyXxZb­h3kClVSNZvPbrcp1eWoyJyznLRLVv3cCWQwmEMr1­071Th4/6dnUZ/wl085HIjV93X9H8nzZ7VBkwHD8Z­HB1foW0/jgbK0qsH2gV7frGFPxZydmk/Nrwdl3Rt­oM+xEpQI7cPYDf9j/CX/ynM4LfOeHhVfMrx0I3E8­wNPX9MU+O+Pu6wsT4WbGkNhcuS4oE2As13obMnUe­bLwOxxWu4ErI8WG1ITwRVEQik72Iqj0d5vvjZw2z­5TFzkMB/Tl3qNvAp9jzpNtvRUyrS6KRY667BZOJ9­TJK/5+jenGEi7+UNq9ig490WnYDBPA/N9QSPHCx6­TLNapayQvem5UCAwEAATANBgkqhkiG9w0BAQsFAA­OCAgEAS9mpX4QgnwntvH9wutY+zOWBLejd/psjjV­mZdYzeVC6fkCaw0Qj1unszq58EHlA8275ARTYyic­RHIYLF3ZDYwMxUCu7iIQJUzVYJRqowV2Ap4OeMlh­5sUb/Wlmhs5TauSZ1gz4LqMqnGkVMrvvU+1WX2eP­Fl81nnr1UMb2+dLzC0Gj2jH3tlzW76yFD4gElR8W­4ypgvAw9pFKlSuOc4y6KS32jaOJk9zWSigPQadI1­pOSSk+iKuPp98BBY/gDw+FBKUNARo3ci5F2s1dJZ­wQSCnuBhVb1r+3aHjnp4PAO7Mq7YyFf7qwSmuA++­nF7TGhu3lf3hY1Jzgo+rOi+pFZtebCsewLDJjyNU­xhQkOIf4TutC9wPJUtCKDpLA0iJso1AX5297iap5­g7y0J0fUls16U+F0arsBHhgIN5ARifImeE+1bVVx­7kLtklA23njczUt88ylgsCEnYyu0U+0+kwAkMDyP­WDd3KPfDhykhQJ0Ev/44+JTDk3zydO2YvCpqMqLu­hbZr9mvmV7uzJVbFnLr3sU75upv0N4JQLIn3XyTt­DbWjTqA8d6qbG5BxYL5xkrWRxo3Fd6r1AyFje1il­KUkwZ1YZZCDvgv/2uEFyL0VlgfHfBhNbN2nsTTxi­jKc19ROeIRXl7eqWq/cyIbA/5LzEy2UbbEhKIroP­GosQML4sc=")
    

    But as a start, since you have the RAM on ESP32, maybe ignore all the flash storage stuff for now. Just remove fwrite and set the variables directly to the result of running atob.

    ... also use the certificates that I used in the example rather than making your own - for now.

  • I did the changes suggested team!
    looks memory problem!

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >Connecting to Wifi
    ERROR: Wifi: event_handler STA_START: esp_wifi_connect: 12298(SSID is invalid)
    Connected...
    { "free": 1964, "usage": 336, "total": 2300, "history": 495,
      "gc": 0, "gctime": 1.864 }
    {
      "VERSION": "2v04",
      "GIT_COMMIT": "3956264e",
      "BOARD": "ESP32",
      "FLASH": 0, "RAM": 524288,
      "SERIAL": "a4cf1275-31c8",
      "CONSOLE": "Serial1",
      "MODULES": "Flash,Storage,heatshrink,fs,net,dgram,t­ls,http,NetworkJS,Wifi,TelnetServer,cryp­to,neopixel",
      "EXPTR": 1073484860 }
    WARNING: Wifi:startMDNS - espressif
    ########################################­######
    {
      "ip": "192.168.0.16",
      "netmask": "255.255.255.0",
      "gw": "192.168.0.1",
      "mac": "a4:cf:12:75:31:c8"
     }
    Acessing AWS IOT
    Connecting...
    Uncaught InternalError: Failed! mbedtls_ssl_setup: Not enough memory
     at line 35 col 10
      }).end();
             ^
    in function called from system
    Acessing AWS IOT
    Connecting...
    Uncaught InternalError: Failed! mbedtls_ssl_setup: Not enough memory
     at line 35 col 10
      }).end();
             ^
    in function called from system
    Disconnected
    >
    

    Here the the software
    https://www.dropbox.com/s/3i0cig5pl9qtd7­e/code.js?dl=0

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ESP32 with CA + PRIVATE + CERTIFICATE

Posted by Avatar for tcpipchip @tcpipchip

Actions