question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Edge Transparent Gateway scenario]Send message using x509=true in connection string

See original GitHub issue

I have set up transparent gateway with downstream device being authenticated to gateway using x509 auth mechanism. My connection string in the downstream device code is as below:- HostName={hostname};DeviceId={downstreamDeviceId};x509=true

The error is I get while instantiating the deviceclient is as below:-

Unexpected error Invalid Connection String - Invalid Key 
Shutting down IoT Hub Client...
Traceback (most recent call last):
  File "./iotagent.py", line 84, in <module>
    main()
  File "./iotagent.py", line 73, in main
    loop.run_until_complete(dowork())
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "./iotagent.py", line 53, in dowork
    device_client = DeviceClient(registration_result, x509)
  File "/app/iotagent/device_client.py", line 21, in __init__
    server_verification_cert=root_ca_cert
  File "/usr/local/lib/python3.7/site-packages/azure/iot/device/aio/patch_documentation.py", line 85, in create_from_connection_string
    connection_string, **kwargs
  File "/usr/local/lib/python3.7/site-packages/azure/iot/device/iothub/abstract_clients.py", line 257, in create_from_connection_string
    connection_string = cs.ConnectionString(connection_string)
  File "/usr/local/lib/python3.7/site-packages/azure/iot/device/common/auth/connection_string.py", line 83, in __init__
    self._dict = _parse_connection_string(connection_string)
  File "/usr/local/lib/python3.7/site-packages/azure/iot/device/common/auth/connection_string.py", line 50, in _parse_connection_string
    raise ValueError("Invalid Connection String - Invalid Key")
ValueError: Invalid Connection String - Invalid Key

It seems as per this code, the key x509 is not supported in python sdk. Or am I missing something?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
cartertinneycommented, Mar 24, 2022

@amit12cool

Version 2.11.0 has been released. You may now use the gateway_hostname keyword in the .create_from_x509_certificate() method.

0reactions
amit12coolcommented, Apr 13, 2022

@cartertinney any inputs?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticate downstream devices - Azure IoT Edge
In a transparent gateway scenario, downstream devices (sometimes called child devices) need identities in IoT Hub like any other device. This ...
Read more >
Connecting child devices to the Azure IoT transparent Edge ...
The edge holds all the security identities of the child devices. The transparent gateway is actually 'transparent'. By default, child devices ...
Read more >
Setup an IoT Edge Gateway - GitHub Pages
Refer to Create a transparent gateway for specifics on using an IoT Edge device ... with a route that sends all messages from...
Read more >
How to connect X.509 authenticated downstream device using ...
please try the following where you pass in your root_ca_cert as a string: Create instance of the device client using the connection string:....
Read more >
Authenticating downstream devices with x.509 certificates
One of the most common scenarios in the industry is to provide one common interface/gateway for the devices to connect and send data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found