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

    WPA2-Enterprise keyfile and certfile invalid path

    Scheduled Pinned Locked Moved LoPy
    4 Posts 2 Posters 48 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.
    • S Offline
      siggin
      last edited by siggin

      Hallo!

      I' trying to connect to an WPA2-Enterprise network using WiFi. Unfortunately I'm running into an early error. The connect method is not finding the files and claims that the file path is wrong. But I'm quit sure that the files are there.
      What am I doing wrong ?

      Thanks!

      print("Wifi test")
      wlan = WLAN(mode=WLAN.STA)
      wlan.antenna(WLAN.EXT_ANT)
      file = open("/flash/cert/GoeSubCA_2020.pem", "r")#only for testing the path
      file.close()
      file = open('/flash/cert/GOEHMQ001-client.key','r')#only for testing the path
      file.close()
      file = open('/flash/cert/GOEHMQ001-client.crt','r')#only for testing the path
      file.close()
      
      wlan.connect(ssid= essentials['wifi_ssid'], auth=(WLAN.WPA2_ENT,), identity='GOEHMQ001', keyfile = '/flash/cert/GOEHMQ001-client.key', certfile = '/flash/cert/GOEHMQ001-client.crt')
      
      while not wlan.isconnected():
          WLAN.status()
          machine.idle()
      while True:
          print(wlan.isconnected())
      

      Output: (line 19 is the one with the connect method)

      Pycom MicroPython 1.20.2.r1 [v1.11-a5aa0b8] on 2020-09-09; LoPy4 with ESP32
      Pybytes Version: 1.6.0
      Type "help()" for more information.
      Reading file status
      [1/1] Writing file main.py (3kb)
      Upload done, resetting board...
      OKets Jun 8 2016 00:22:57

      rst:0x7 (TG0WDT_SYS_RESET),boot:0x3b (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:19760
      entry 0x400a05bc
      Wifi test
      Traceback (most recent call last):
      File "main.py", line 19, in <module>
      ValueError: invalid file path

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by Gijs

        Hi,

        Today I had some time to dive deeper into this issue. Its quite complicated though and Ill try my best to explain it here:

        It seems the function that loads the certificate files is added in the wlan = WLAN() operation, though that does not accept the keyword arguments for these files.

        Then wlan.connect() assumes the files are already read and then discovers they are 'empty', returning a bad-file error.

        I have now implemented the read-file function before the files are needed, probably solving the issue (I dont have a WPA2-ENT network to test with currently).

        I attached the custom firmware here, let me know if that works for you! You can upload it using the firmware updater. I can also compile a version with Pybytes/Pygate if that is what you need!
        Gijs

        https://we.tl/t-mB7AYPTzm7

        NB. you use the function WLAN.status(), that does not seem to exist

        1 Reply Last reply Reply Quote 0
        • S Offline
          siggin
          last edited by

          Hi,
          thanks for your answer! I uploaded the new firmware and the error is not showing up anymore. Unfortunately I can not establish a connection but this might be a problem with the files itself. To verify this I have to speak with peoples of our IT department.
          I will report to this next week!

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by

            Well, it could also be a problem on my side, let me know what you get!

            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