Skip to content

Need solution for asyncio SSL/TLS connections #8647

@RuofengX

Description

@RuofengX

I am running esp32c3-usb-20220117-v1.18.bin

TL;DR

How to open a SSL or TLS connection using uasyncio?


I am tryign to port a CPython project onto Micropython.

In CPython asyncio, we could open a SSL connection easily by using ssl argument in asyncio.open_connection() method.
When I am trying to use uasyncio.open_connection(..., ssl=True), it raises an exception saying that there's no ssl argument. We can confirm it on the doc page here.

Then I try to use ssl module to warp the socket in StreamWriter.get_extra_info("socket")(I never test this, I don't know whether this would work, just have a try), but I cannot get the "raw" socket of this connection, because function uasyncio.Stream.get_extra_info only accept "peername" as a param, no support for "socket". We can check it here.

If there's a method to open an SSL/TLS connection by using uasyncio? I really want to use asyncio because I think that is the best part of python language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions