Directly Pass SSL certificates



  • 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.


Log in to reply
 

Pycom on Twitter