-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
HomeKit Controller can't add new device UnsupportedAlgorithm: ed25519 #45363
Comments
Hi. This definitely works if you have the right version of openssl and cryptography, and the pyatv issue hits the nail on the head. I think you have the right version of cryptography but for whatever reason your underlying openssl does not support ed25519. You might have better luck on the forums, i'm not an expert in this part of the setup. I can see the code in I can reproduce it working on ubuntu 20.04 on x86_64 like this:
You can see that ubuntu 20.04 and cryptography 3.2 here work, and the function that errors for you returnns a private key object. This works for me, today. Note that this will install a wheel which is precompiled with a sensible version of openssl - it will completely ignore the one on your host. You will see this:
For a raspberry pi its likely that a wheel isn't available, and so it is picking up the version of openssl on the host. Piwheels does precompile wheels for raspbian though - see https://www.piwheels.org/project/cryptography/. But it is for python 3.5 and 3.7, not python 3.9 like in your example. |
Maybe problem with install from source new version of openssl openssl/openssl#11227 |
I have OpenSSL 1.1.1g 21 Apr 2020 on armv7 platform But I can generate certificate with ed25519
|
Can you confirm your os version, python version, cryptography version, etc. Which bits (if any) did you compile from source? |
uname -a
python -V
pip list | grep crypto
OpenSSL 1.1.1g is compiled with configuration |
At the moment i'm still treating this as an environment issue. Someone needs to show me this code:
Working, but home-assistant not, for it to be something I can really do anything about. If you need help getting ^ to work you might have more luck in the forums, on the HA discord or with cryptography themselves. The most likely scenario I have is that you have multiple opennssl versions on your system and I don't have a bananapi. And I use the docker container to avoid exactly these sorts of conflicts with self installed from source libs. Unfortunately theres not much else I can do. |
@Jc2k ed25519 used only once when connecting a device? If this is used once, perhaps you can take a python implementation in case of a breakdown and show the progress bar so that users wait. Or maybe it is possible to copy and paste the cipher and generate it on the computer, and then paste it into the input field? |
Thanks for the suggestion, but I don't think I could accept either of those ideas. While there are only 2 of you, the correct solution is to figure how to install cryptography properly on your devices. If you document exactly how you go from fresh raspbian to this code:
failing with the error you reported then maybe someone will be able to either spot the problem or reproduce the error and investigate. The approach will be the same if more people come forward, but it might be a default config option has changed upstream recently and we can get that fixed or at least documented. |
As requested, an error log showing the X25519 error. |
This is your first time commenting on this issue. Can you please provide some context. Arm? Pi? Banana Pi? Python version? Cryptography version? Can you all provide detailed walkthroughs of everything you have done to get to this stage. If you followed some instructions online can you link to them. Also has anyone tried the python code I posted? |
I found the problem. Jc2k is right, cryptography has picked up the wrong openssl. What happened is, originally I have openssl 1.1.0l. At that time I tried many things including updating to cryptography 3.3.1. Then I found out openssl 1.1.0l doesn't support ed25519, so I compile openssl 1.1.1i and install it. After that I remove cryptography 3.3.1 and reinstall it, but in fact that cryptography binary is still bind to previous openssl 1.1.0l. Notice "pip install cryptography==3.3.1" will grab old cryptography from pip cache
I have to remove this cache and "pip install cryptography==3.3.1" will rebuild binary with up-to-date openssl 1.1.1i. |
In fact there is no problem also using cryptography 3.2 as long binary built correctly with openssl which supports ed25519. |
That makes a lot of sense! I forgot that pip creates a wheel cache these days indeed. It also fits with my attempts to reproduce - I was starting in fresh environments for each test, so I didn't have a polluted wheel cache. Great work figuring it out @dony71 ! |
OpenSSL 1.1.1f still has bug, it is bug of ubuntu 20.04 lts end of life 2025, so OpenSSL should fix version in LTS Ubuntu, or add new version to backports. Install from source is not recommended by openSSL, since this breaks operating system packages |
Well, it's up to Ubuntu to fix their OpenSSL package if it contains a bug. OpenSSL themselves might not be in charge of that. And we at HA certainly can't. I think i'm going to close this soon unless the situation changes. |
@Jc2k Ok, close, now it is clear that this is not a problem of Home Assistant |
Yes, remove cache ./.cache/pip/wheels/ everywhere works |
The problem
I try to add Legrand Netatmo hub using HomeKit Controller, but I have error in HA logs.
cryptography.exceptions.UnsupportedAlgorithm: ed25519 is not supported by this version of OpenSSL.
Environment
Problem-relevant
configuration.yaml
no yaml integration
Traceback/Error logs
Additional information
My current version of cryptography is 3.2, OpenSSL (version 1.1.1f 31 Mar 2020) I found my bug on github postlund/pyatv#831 So, it tried to update cryptography to 3.3.1, also tried to build from source OpenSSL version 1.1.1i, also i tried on different version of OS Raspbian 10 and OS Raspbian 9, also I try different container with Ubuntu 18 and 20. I have raspberry 3 b+ I have always same error
The text was updated successfully, but these errors were encountered: