Skip to content
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

ed25519 is not supported cryptography version: 3.2 #5704

Closed
nick2525 opened this issue Jan 27, 2021 · 8 comments
Closed

ed25519 is not supported cryptography version: 3.2 #5704

nick2525 opened this issue Jan 27, 2021 · 8 comments

Comments

@nick2525
Copy link

nick2525 commented Jan 27, 2021

cryptography Version: 3.2 reports that ed25519 is not supported by this version of OpenSSL, but in OpenSSL 1.1.1f ed25519 already supported.

My docker container is
lsb_release -a

Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

uname -a

Linux raspberrypi 5.4.83-v7+ armv7l armv7l armv7l GNU/Linux
Debug in Python, Python is in virtualenv

Python 3.9.0 (default, Oct 28 2020, 23:50:03)
[GCC 7.4.0] on linux

from cryptography.hazmat.backends import default_backend
default_backend().openssl_version_text()
'OpenSSL 1.1.1f 31 Mar 2020'

So, I have openssl version 1.1.1f
when I try in python

from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
Ed25519PrivateKey.generate()

Traceback (most recent call last):
File "", line 1, in
File "/home/nick252/homeassistant/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py", line 52, in generate
raise UnsupportedAlgorithm(
cryptography.exceptions.UnsupportedAlgorithm: ed25519 is not supported by this version of OpenSSL.

More info home-assistant/core#45363 and also created bug in OpenSSL openssl/openssl#13974

Sadness is that OpenSSL 1.1.1f is included in ubuntu 20.04 LTS and is unlikely to be updated, and now it's not even clear which side of the bug is on

@alex
Copy link
Member

alex commented Jan 27, 2021

That's bizzare, ed25519 should be supported with any OpenSSL >=1.1.1b.

Can you tell me what happens when you run:

from cryptography.hazmat.bakends import default_backend
b = default_backend()
print(b._fips_enabled, b._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B)

@alex
Copy link
Member

alex commented Jan 27, 2021

Sigh, let's try again but without typos:

from cryptography.hazmat.backends import default_backend
b = default_backend()
print((b._fips_enabled, b._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B))

@nick2525
Copy link
Author

nick2525 commented Jan 27, 2021

@alex (homeassistant) root@raspberrypi:/home/nick252/homeassistant# python3
Python 3.9.0 (default, Oct 28 2020, 23:50:03)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from cryptography.hazmat.backends import default_backend
b = default_backend()
print((b._fips_enabled, b._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B))
(False, 1)

@tiran
Copy link
Contributor

tiran commented Jan 27, 2021

Ubuntu 20.04 should have OpenSSL 1.1.1f. What's output of print(hex(b._lib.OPENSSL_VERSION_NUMBER))?

Did you perhaps compile cryptography on Ubuntu 18.04 and then copy the files to a 20.04 box?

@alex
Copy link
Member

alex commented Jan 27, 2021

This looks to me like your cryptography was compiled against one version of OpenSSL, but linked against another. How did you install it?

@nick2525
Copy link
Author

@tiran >>> print(hex(b._lib.OPENSSL_VERSION_NUMBER))
0x1010100f
I upgraded version of Ubuntu by
rename in /etc/apt/sources.list
sudo sed -i 's/bionic/focal/g' /etc/apt/sources.list
and when upgrade

@alex I installed it on Ubuntu 18.04, and I think in was upgraded during migrate to 20.04

@alex
Copy link
Member

alex commented Jan 27, 2021

Yes, you need to reinstall (re-compile) cryptography if you upgrade the OpenSSL its linked against.

@alex alex closed this as completed Jan 27, 2021
@nick2525
Copy link
Author

Yes remove python cache ./.cache/pip/wheels/ everywhere fixes it

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants