-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
circuit python 8.2.9 SSL : (-8576, 'MBEDTLS_ERR_X509_INVALID_FORMAT') #8799
Comments
it seems this let me pass to next step : # Charger le certificat auto-signé
with open("cert.pem", "r") as cert_file:
cert_data = cert_file.read()
ssl_context.load_verify_locations(cadata=cert_data)
but now i got this message :
Données JSON à envoyer : {'eCO2': 400}
Type d'erreur: RuntimeError
Message d'erreur: Sending request failed
with this
print("Données JSON à envoyer :", data)
# Envoi des données à l'API REST via une requête POST
try:
response = http_session.post(url, json=data)
print("Données envoyées avec succès, réponse:", response.json())
except Exception as e:
print("Type d'erreur:", type(e).__name__)
print("Message d'erreur:", e)
time.sleep(60) and i really don't understand... Hope someone could help. I'm really out of idea! |
(edited code formatting, hope you don't mind) Do you get You may want to use the import traceback
# ...
try:
# some stuff ...
except Exception as ex:
traceback.print_exception(ex, ex, ex.__traceback__) |
Thank you Anecdata ! Pico work i can connect to network and send ping to google for exemple. Thanks again |
here is the result of the traceback : Connected to WiFi L'exception précédente est la cause directe de l'exception suivante: Traceback (appels les plus récents en dernier) : Here we clearly have a certification verification issue... |
@FranckyFroggy Please re-test with CircuitPython 9.2.5. This release includes an update (#10027) that improves lwip (the IP stack used by CircuitPython) memory management, 3-way handshake timing, and TLS handshake timing. |
Erreur lors de l'envoi des données: (-8576, 'MBEDTLS_ERR_X509_INVALID_FORMAT')
This is the type of error i get with my program in circuitpython (8.2.9) using PI Pico W and SSL.
SSL is used to secure communication between Pico W and a Flask server running on a Raspberry pi 4.
The certificate looks valid (no weird caracter), was put at the root of the pico W and was generated using this command : openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes.
I don't undertsand what's wrong with the format...
The code is as follows :
The error I get comes at this point.
Any idea ?
The program does eveything but could not send the data to Flask.
Hope someone can help me find what's wrong here ...
The text was updated successfully, but these errors were encountered: