Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Directly Pass SSL certificates

    Scheduled Pinned Locked Moved GPy
    2 Posts 2 Posters 34 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Abdul Rehman
      last edited by

      Hi All, Good Day.
      I am using my Gpy board to connect AWS IoT core using the mqtt.py library. There is no issue that arises when I connect with AWS IoT using SSL certificates, SSL certificates were saved in a separate file and I accessing their directory. But the requirement is SSL certificates need to be in the buffer or string, so when I directly pass the string containing SSL certificates in mqtt.MQTTClient() method, there appears a whole lot of issues.

      Here is the code for refrence

      AWS_CLIENT_CERT = "MIIDWjCCAkKgAwIBAgIVAMRIbQzWQ" # Complete certificate
      AWS_PRIVATE_KEY = "MIIEowIBAAKCAQEAmVfhZ40rnuK" #Complete key
      AWS_Port = 8883
      AWS_URL = "AWS URL"
      clientID = "PYCOM_GPY_3"
      topicPb = "$aws/things/update"
      topicSb= "$aws/things/update/accepted"
      
      
      client = mqtt.MQTTClient("PYCOMGPY3",
                          "AWS_URL",
                          port=8883,
                          keepalive=10000,
                          ssl=True,
                          ssl_params={
                          "certfile":AWS_CLIENT_CERT,
                          "keyfile":AWS_PRIVATE_KEY
                 
                          #"server_side"=False
                          })
      time.sleep(2)
      client.set_callback(sub_cb)
      
      #client.subscribe(topic=topicSb)
      client.connect()
      

      Here debug output.

      /Users/ehlers/pycom/pycom-esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
      abort() was called at PC 0x400943a0 on core 1
      
      ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000
      
      Backtrace: 0x4008eeef:0x3ffd7960 0x4008f071:0x3ffd7980 0x400943a0:0x3ffd79a0 0x40112893:0x3ffd79e0 0x400e17b9:0x3ffd7a00 0x400e2c25:0x3ffd7a50 0x400f4268:0x3ffd7bc0 0x40116d62:0x3ffd7c40 0x40101459:0x3ffd7cc0 0x400fd811:0x3ffd7cf0 0x400fded0:0x3ffd7d10 0x401098a1:0x3ffd7d70 0x40101500:0x3ffd7e10 0x400fd811:0x3ffd7e90 0x400fd8a1:0x3ffd7eb0 0x40109853:0x3ffd7ed0 0x40101500:0x3ffd7f70 0x400fd811:0x3ffd7fa0 0x400fd83e:0x3ffd7fc0 0x400e12e5:0x3ffd7fe0 0x400e1431:0x3ffd8080 0x400e0006:0x3ffd80b0
      
      ================= CORE DUMP START =================
      KDkAAAEAAAAQAAAAbAEAAA==
      /EP8P6B4/T/kgf0/
      0Hf9P4CB/T8xBAIAGEH8PxhB/D/8Q/w/EEH8Pw4AAADgdfs/4HX7P/xD/D8AAAAA
      CwAAAOhR/T9NaWNyb1B5AAAAAAAAAAAAAQAAAOSB/T8AAAAAIA8GAAsAAAABAAAA
      +DT7PxyS/D8AAAAAAAAAAAAAAADUZPs/PGX7P6Rl+z8AAAAAAAAAAAEAAAAAAAAA
      Z4RAPwAAAABoGAlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAA==
      
      A whole lot of other garbage data in between. 
      
      ================= CORE DUMP END =================
      Rebooting...
      ets Jun  8 2016 00:22:57
      
      rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
      mode:DIO, clock div:1
      load:0x3fff8020,len:8
      load:0x3fff8028,len:2140
      ho 0 tail 12 room 4
      load:0x4009fa00,len:19740
      entry 0x400a05bc
      Pycom MicroPython 1.20.2.r3 [v1.11-d945d33ee] on 2020-03-08; GPy with ESP32
      Type "help()" for more information.
      

      Please guide me on this issue any help would be appreciated.

      1 Reply Last reply Reply Quote 0
      • C Offline
        Cédric Antenen
        last edited by

        Hello everyone, Hello @Abdul-Rehman

        A year later but might you see it what was your solution for this kind of error? I have quite the same case in my code. So I try to connect a client on the gpy and get it along with a localhost server.

        Server-side:

        httpd.socket = ssl.wrap_socket(httpd.socket,
                                   server_side=True,
                                   certfile='cert.pem',
                                   keyfile='key.pem',
                                   ssl_version=ssl.PROTOCOL_TLS)
        

        Client-side:

        socket_get = ussl.wrap_socket(socket_get, certfile='cert5.pem', keyfile='key5.pem', server_side=False)
        

        In my case peters (not known) home folder is called.

        /home/peter/docs/pycom-esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
        abort() was called at PC 0x40094114 on core 1
        
        ELF file SHA256: 0000000000000000000000000000000000000000000000000000000000000000
        
        Backtrace: 0x4008ef0f:0x3ffd8140 0x4008f091:0x3ffd8160 0x40094114:0x3ffd8180 0x401130e7:0x3ffd81c0 0x400e17e5:0x3ffd81e0 0x400e2c51:0x3ffd8230 0x400f4760:0x3ffd83a0 0x401175be:0x3ffd8420 0x40101a19:0x3ffd84a0 0x400fddb5:0x3ffd84d0 0x400fde45:0x3ffd84f0 0x40109e13:0x3ffd8510 0x40101ac0:0x3ffd85b0 0x400fddb5:0x3ffd85e0 0x400fe470:0x3ffd8600 0x40109dc5:0x3ffd8660 0x40101ac0:0x3ffd8700 0x400fddb5:0x3ffd8770 0x400fde45:0x3ffd8790 0x40109e13:0x3ffd87b0 0x40101ac0:0x3ffd8850 0x400fddb5:0x3ffd8880 0x400fde45:0x3ffd88a0 0x40109e13:0x3ffd88c0 0x40101ac0:0x3ffd8960 0x400fddb5:0x3ffd89e0 0x400fde45:0x3ffd8a00 0x40109e13:0x3ffd8a20 0x40101ac0:0x3ffd8ac0 0x400fddb5:0x3ffd8af0 0x400fde45:0x3ffd8b10 0x40109e13:0x3ffd8b30 0x40101ac0:0x3ffd8bd0 0x400fddb5:0x3ffd8c40 0x400fdde2:0x3ffd8c60 0x400e1311:0x3ffd8c80 0x400e15b5:0x3ffd8d20 0x400e0020:0x3ffd8d40
        

        Has anyone a idea what I am doing wrong?

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom